Package not found error when building the maven project - java

I have created a maven project and i am going to use a .jar file that already created by someone. I have added it into the class path and used it and there are no errors showing in eclipse. But when i try to clean build the project there is an error as follows.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile
(default-compile) on project DigitalWallet: Compilation failure:
Compilation failure:
[ERROR] /E:/DigitalWallet_V0.1/DigitalWallet/src/main/java/com/MobiOs/config/Log4jConfig.java:[11,23]
package com.mobios.util does not exist
[ERROR] /E:/DigitalWallet_V0.1/DigitalWallet/src/main/java/com/MobiOs/config/Log4jConfig.java:[25,17]
cannot find symbol
[ERROR] symbol: variable LogUtil
[ERROR] location: class com.MobiOs.config.Log4jConfig
[ERROR] /E:/DigitalWallet_V0.1/DigitalWallet/src/main/java/com/MobiOs/config/Log4jConfig.java:[26,17]
cannot find symbol
[ERROR] symbol: variable LogUtil
[ERROR] location: class com.MobiOs.config.Log4jConfig
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
It saying the package com.mobios.util does not exist.
#Configuration
#EnableTransactionManagement
#ComponentScan({ "com.MobiOs.config", "com.mobios.util" })
public class Log4jConfig {
#Bean
public void initilizeLog4j() throws UnsupportedEncodingException {
LogUtil.init("/conf/log4j.xml");
LogUtil.getEventLog().debug("Kasun" +
",SERVICE_INITIALIZED,initialized_logs,,");
}
}
In web Config i have set the component scan also`
#Configuration
#EnableWebMvc
#ComponentScan({ "com.MobiOs", "com.mobios" })
public class WebConfig {
}
But i am getting the above error.
Note : My package name is com.MobiOs.config But the imported jar package name is com.mobios.util

You have two packages with same case insensitive names com.MobiOs to com.mobios which represent physically two directories with same case insensitive names. This can lead to an issue if your file system is case insensitive, or expect specific case as lower case.
Java's package names should be lower case:
Package names are written in all lower case to avoid conflict with the names of classes or interfaces.
If you are not convinced, see comment:
On some versions of some Windows file systems names that are entered in all caps are displayed in all lowercase as the default. This is probably to be friendly towards files from systems that don’t distiguish case — these may come in in all uppercase and look better in all lowercase. While the file name is still uppercase behind the scenes, this may have caused confusion

Related

Javadoc issue package does not exist in java11

Javadoc says package doesnt exist in all the imports. This same setup worked for Java1.8 but with java 11 it has this issue
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:2.9:jar (attach-javadocs) on project esymac: MavenReportException: Error while creating archive:
[ERROR] Exit code: 1 - /home/JDK/com/SelfMonServiceLocator.java:23: error: package com does not exist
[ERROR] import com.SelfMonConstants;
[ERROR] ^
It was working in java1.8 properly with the same classes and pom.xml. But with java11 it fails to find packages.

Why does jacoco:check give an error when I create a test class

I am using IntelliJ and when I run my project it works fine with jacoco and all dependencies.
When I create a test class I suddenly get an error and I don't understand why.
The error I get is this one.
[ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.8.5:check (jacoco-check) on project
statistik-jar: Coverage checks have not been met. See log for details. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following
articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :statistik-jar
When I have one test class, it works fine, but it gives this error when I add one more. The folder looks like this when I get the error:
/Test
/test.class <-- working
/folder
/test2.class <-- gives a error
This error occurs when creating a second class
Because Jacoco works with percentile if you create more classes and do not have relative tests it will give the error.
<value>COVEREDRATIO</value>
<minimum>0.xx</minimum>
Check these data. I will give you some insight.

Maven compilation error: package does not exist and cannot find symbol

I run maven using mvn clean verify -U -e -DskipITs=true
and get the following compilation error. When I run with the debug option -X it points me to the https://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException but I cannot find the underling problem.
These packages are part of the magnolia-pages-app-5.6.4.jar with is
in my .m2 directory under
/Users/asusti/.m2/repository/info/magnolia/pages/magnolia-pages-app/5.6.4/magnolia-pages-app-5.6.4.jar
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/asusti/Projects/xxx-wcms/xxx-module-versioning/src/main/java/ch/xxx/module/versioning/VersionSelector.java:[5,38] package info.magnolia.pages.app.editor does not exist
[ERROR] /Users/asusti/Projects/xxx-wcms/xxx-module-versioning/src/main/java/ch/xxx/module/versioning/VersionSelector.java:[6,48] package info.magnolia.pages.app.editor.extension does not exist
[ERROR] /Users/asusti/Projects/xxx-wcms/xxx-module-versioning/src/main/java/ch/xxx/module/versioning/VersionSelector.java:[12,38] cannot find symbol
symbol: class AbstractExtension
[ERROR] /Users/asusti/Projects/xxx-wcms/xxx-module-versioning/src/main/java/ch/xxx/module/versioning/VersionSelector.java:[15,17] cannot find symbol
symbol: class PageEditorPresenter
location: class ch.xxx.module.versioning.VersionSelector
[ERROR] /Users/asusti/Projects/xxx-wcms/xxx-module-versioning/src/main/java/ch/xxx/module/versioning/VersionSelector.java:[18,83] cannot find symbol
symbol: class PageEditorPresenter
location: class ch.xxx.module.versioning.VersionSelector
I added this into my module's pom file and after that maven worked:
<!-- magnolia pages extensions for pagebar functionality -->
<dependency>
<groupId>info.magnolia.pages</groupId>
<artifactId>magnolia-pages-app</artifactId>
<version>5.6.4</version>
</dependency>

Maven - Debug - Can not find symbol

During using mvn install or mvn compile i got error that maven can not find symbol with different methods and variables in mozilla rhino classes. I made exclusions everywhere where it is possible and said to use 7r5 build for rhino. Also i decompiled jar and got sure that mentioned classes and methods in maven were in that classes. I had pom deps and i couldnt exclude all 3d libraries. So in classpath i saw also path to rhino 6r5 library. I thought that problem was there. So i also decompiled that jar but i saw that methods in the error were also there. My question is how i can debug maven and see what library or class it is using for compiling class. All mozilla rhino libraries which are set in classpath have that methods.
PS: I wanted to mention that mvn eclipse:eclipse works fine and i have no errors in eclipse.
[ERROR] ...path_to_class...:[264,65] cannot find symbol
[ERROR] symbol: method getLength()
[ERROR] location: class org.mozilla.javascript.NativeArray
[ERROR] ...path_to_class...:[288,18] cannot find symbol
[ERROR] symbol: method getWrapFactory()
[ERROR] location: variable cx of type org.mozilla.javascript.Context
[ERROR] ...path_to_class...:[322,49] cannot find symbol
[ERROR] symbol: method getLength()
[ERROR] location: variable array of type org.mozilla.javascript.NativeArray

Add jars in a maven module

I download Weasis code and run it on Eclipse using maven.
Now I create a new class that use JMF so I want to add jmf.jar.
I follow the answers from here but I take the follow
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project weasis-base-ui: Compilation failure: Compilation failure:
[ERROR] /C:/Users/Ioanna/git/Weasis/weasis-base/weasis-base-ui/src/main/java/org/weasis/base/ui/gui/WeasisVideo.java:[14,19] package javax.media does not exist
[ERROR] /C:/Users/Ioanna/git/Weasis/weasis-base/weasis-base-ui/src/main/java/org/weasis/base/ui/gui/WeasisVideo.java:[15,19] package javax.media does not exist
[ERROR] /C:/Users/Ioanna/git/Weasis/weasis-base/weasis-base-ui/src/main/java/org/weasis/base/ui/gui/WeasisVideo.java:[16,19] package javax.media does not exist
[ERROR] /C:/Users/Ioanna/git/Weasis/weasis-base/weasis-base-ui/src/main/java/org/weasis/base/ui/gui/WeasisVideo.java:[17,19] package javax.media does not exist
[ERROR] /C:/Users/Ioanna/git/Weasis/weasis-base/weasis-base-ui/src/main/java/org/weasis/base/ui/gui/WeasisVideo.java:[18,27] package javax.media.control does not exist
[ERROR] /C:/Users/Ioanna/git/Weasis/weasis-base/weasis-base-ui/src/main/java/org/weasis/base/ui/gui/WeasisVideo.java:[19,26] package javax.media.format does not exist
[ERROR] /C:/Users/Ioanna/git/Weasis/weasis-base/weasis-base-ui/src/main/java/org/weasis/base/ui/gui/WeasisVideo.java:[20,24] package javax.media.util does not exist
[ERROR] /C:/Users/Ioanna/git/Weasis/weasis-base/weasis-base-ui/src/main/java/org/weasis/base/ui/gui/WeasisVideo.java:[33,26] cannot find symbol
[ERROR] symbol: class Player
[ERROR] location: class org.weasis.base.ui.gui.WeasisVideo
[ERROR] /C:/Users/Ioanna/git/Weasis/weasis-base/weasis-base-ui/src/main/java/org/weasis/base/ui/gui/WeasisVideo.java:[36,12] cannot find symbol
[ERROR] symbol: class Buffer
Do anyone know what is the problem. The class file that I used the jmf function doesn't appears errors.

Categories

Resources