I had a perfectly working project. I was able to do a successful build and deployment. Yesterday as a part of development I had to add the following maven dependencies for Jackson jars in my project after which the mvn clean install started to fail.
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.5.3</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.5.3</version>
</dependency>
The error message that I get is
[ERROR] Failed to execute goal on project compass_app: Could not
resolve dependencies for project
com.XXXXX.services:compass_app:jar:1.0-SNAPSHOT: Failed to collect
depe dencies at org.codehaus.jackson:jackson-mapper-asl:jar:1.5.3 ->
org.codehaus.jackson:jackson-core-asl:jar:1.9.13: Failed to read
artifact descriptor for org.codehaus.jackson:jackson-core-asl:j
r:1.9.13: Could not transfer artifact
org.codehaus.jackson:jackson-core-asl:pom:1.9.13 from/to m-all
(http://XXXX/archives/all): Failed to transfer file:
http://XXXX/archives/all/org/codehaus/jackson/jackson-core-asl/1.9.13/jackson-core-asl-1.9.13.pom.
Return code is: 500 , ReasonPhrase:Unable to find managed repository
configuration for id:npanXXXX-1.5.0-maestXXXX-33. -> [Help 1]
My concern is why is the version 1.9.13 attempted for a download when I have not specified it anywhere in my project
I have only one declaration of jackson jars in my pom file.
I have tried doing a mvn -X clean install > install.txt .
Following pieces of trace may be helpful.
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<artifact default-value="${project.artifact}"/>
<attachedArtifacts default-value="${project.attachedArtifacts}"/>
<createChecksum default-value="false">${createChecksum}</createChecksum>
<localRepository>${localRepository}</localRepository>
<packaging default-value="${project.packaging}"/>
<pomFile default-value="${project.file}"/>
<updateReleaseInfo default-value="false">${updateReleaseInfo}</updateReleaseInfo>
</configuration>
The Exception is.
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project compass_app: Could not resolve dependencies for project com.XXXX.services:compass_app:jar:1.0-SNAPSHOT: Failed to collect dependencies at org.codehaus.jackson:jackson-mapper-asl:jar:1.5.3 -> org.codehaus.jackson:jackson-core-asl:jar:1.9.13
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:220)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:127)
at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:257)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:200)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project com.XXXX.services:compass_app:jar:1.0-SNAPSHOT: Failed to collect dependencies at org.codehaus.jackson:jackson-mapper-asl:jar:1.5.3 -> org.codehaus.jackson:jackson-core-asl:jar:1.9.13
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:167)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:195)
... 22 more
Any assistance will be greatly helpful. thanks in advance.
References :- The following links have already been referred.
1. jersey and jackson maven dependency issues?
2. http://maven.apache.org/ref/3.1.1/xref/org/apache/maven/artifact/resolver/DebugResolutionListener.html ( to understand the code and working of maven )
3. http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
My concern is why is the version 1.9.13 attempted for a download when
I have not specified it anywhere in my project
Please use mvn dependency:tree (see: documentation) so that you will be able to track why this version is being loaded.
It is probably kind of transitive dependency.
Related
I have using latest version of MAVEN. I have to projects which I want to build using MAVEN.
My first project is a module based project which has two modules. Parent POM for this project consists 2 child POMS. I am going to Pass version as variable through command prompt to make this build independent of static version.
My parent POM looks like :
<modelVersion>4.0.0</modelVersion>
<groupId>A.B.C</groupId>
<artifactId>D</artifactId>
<version>${major.version}.${build.version}</version>
<packaging>pom</packaging>
<!-- Some further code-->
One Module have POM like :
<parent>
<groupId>A.B.C</groupId>
<artifactId>D</artifactId>
<version>${major.version}.${build.version}</version>
</parent>
**<groupId>A.B.C</groupId>
<artifactId>E</artifactId>**
<version>${major.version}.${build.version}</version>
<!-- Some further code-->
Second Module have POM like :
<parent>
<groupId>A.B.C</groupId>
<artifactId>F</artifactId>
<version>${major.version}.${build.version}</version>
</parent>
**<groupId>A.B.C</groupId>
<artifactId>G</artifactId>**
<version>${major.version}.${build.version}</version>
<!-- Some further code-->
My Second project uses above dependency in its POM like :
<modelVersion>4.0.0</modelVersion>
<groupId>A.B.C</groupId>
<artifactId>T</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
**<groupId>A.B.C</groupId>
<artifactId>E</artifactId>
<version>LATEST</version>**
</dependency>
<dependency>
**<groupId>A.B.C</groupId>
<artifactId>G</artifactId>
<version>LATEST</version>**
</dependency>
But while using mvn clean install, it gives error for
[ERROR] Failed to execute goal on project T: Could not resolve dependencies for project
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact A.B.C:D:pom:${major.version}.${build.version} from/to nexus-all-repos : IllegalArgumentException
But if I use command mvn versions:use-latest-versions, it works fine. I want to use mvn install as I want to use latest version for some dependencies only.
What might be the issue?
Adding complete error stack
[ERROR] Failed to execute goal on project T: Could not resolve dependencies for project A.B.C:T:jar:5.6.0.15: Failed to collect dependencies at A.B.C:E:jar:LATEST: Failed to read artifact descriptor for A.B.C:E:jar:LATEST: Could not tran
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project T: Could not resolve dependencies for project A.B.C:T:jar:5.6.0.15: Failed to collect dependencies at A.B.C:E:jar:LATEST
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:220)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:127)
at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:257)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:200)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project A.B.C:T:jar:5.6.0.15: Failed to collect dependencies at A.B.C:E:jar:LATEST
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:167)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:195)
... 22 more
Caused by: org.eclipse.aether.collection.DependencyCollectionException: Failed to collect dependencies at A.B.C:E:jar:LATEST
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:292)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:317)
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:159)
... 23 more
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for A.B.C:E:jar:LATEST
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:384)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:231)
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:461)
at org.eclipse.aether.internal.impl.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:261)
... 25 more
Caused by: org.apache.maven.model.resolution.UnresolvableModelException: Could not transfer artifact A.B.C:D:pom:${major.version}.${build.version} from/to nexus-all-repos (http://eqmavenrepo.technologic.com/nexus/content/groups/allrepo/): IllegalArgumentException
at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:170)
at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:219)
at org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:898)
at org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:750)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:309)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:375)
... 28 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact A.B.C:D:pom:${major.version}.${build.version} from/to nexus-all-repos (http://eqmavenrepo.technologic.com/nexus/content/groups/allrepo/): IllegalArgumentException
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:459)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:262)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:239)
at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:166)
... 33 more
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact A.B.C:D:pom:${major.version}.${build.version} from/to nexus-all-repos (http://eqmavenrepo.technologic.com/nexus/content/groups/allrepo/): IllegalArgumentException
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$6.wrap(WagonRepositoryConnector.java:1016)
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$6.wrap(WagonRepositoryConnector.java:1004)
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:725)
at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.IllegalArgumentException
at java.net.URI.create(URI.java:842)
at org.apache.maven.wagon.providers.http.httpclient.client.methods.HttpGet.<init>(HttpGet.java:69)
at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:841)
at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)
at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)
at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)
at org.eclipse.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:660)
... 4 more
Caused by: java.net.URISyntaxException: Illegal character in path at index 119: http://eqmavenrepo.technologic.com/nexus/content/groups/allrepo/A/B/C/D/${major.version}.${build.version}/D-${major.version}.${build.version}.pom
at java.net.URI$Parser.fail(URI.java:2809)
at java.net.URI$Parser.checkChars(URI.java:2982)
at java.net.URI$Parser.parseHierarchical(URI.java:3066)
at java.net.URI$Parser.parse(URI.java:3014)
at java.net.URI.<init>(URI.java:578)
at java.net.URI.create(URI.java:840)
... 10 more
[ERROR]
[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/DependencyResolutionException
Still getting error after removing illegal characters
This is not the way Maven works. Don't look at the POM as a mere build script, but more as a delivery slip shipped together with your artifact that explains how it is connected to the rest of the world, e.g. in terms of dependencies and how it was built (note the past tense), not how to build it, like Ant.
The problem is that if Maven would allow you to parameterize ${major.version}.${build.version} and use them as coordinates, when it installs/deploys it might be able to do right thing and deploy your artifact to http://.../E/X.Y/E-X.Y.pom (if you used mvn -Dmajor.version=X -Dbuild.version=Y ...).
But then the problem comes later. Another user might download your artifact correctly, but when Maven tries to parse the POM, it will encounter ${major.version}.${build.version} and wouldn't know what to do because the actual values were provided by you when you deployed and are lost in the process.
This is the reason why Maven coordinates need to be fixed and are not extrapolated with properties; it gives you (and perhaps more importantly, any other dependant) control and traceability. Of course, other non-coordinate properties may be parameterized to your heart's content, it's just coordinates that are more sensitive to this.
Maven coordinates uses five values, three of them more common than the other: groupId, artifactId and version. The other two are packaging and classifier, but are used for more exotic use-cases.
I would advise you to rethink your building approach if you are going to use Maven. It has a steep learning curve, but the view is magnificent from the top. Releasing artifacts using Maven is better done through, for instance, the Maven Release plugin.
i think problem related to wrong symbols in path to repo cuz this is in stacktrace. try check all paths related to nexus repo.
Caused by: java.net.URISyntaxException: Illegal character in path at index 119: ~^~content/groups/allrepo/~^~/E/${major.version}.${build.version}/E-${major.version}.${build.version}.pom
I'm using hibernate-jpamodelgen to generate the metamodel classes using maven.
When i run mvn clean package, it works fine without any problem. But if i run the mvn package second time (without clean), I'm getting the following exception :
An exception has occurred in the compiler (1.8.0_51). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.IllegalStateException: endPosTable already set
at com.sun.tools.javac.util.DiagnosticSource.setEndPosTable(DiagnosticSource.java:136)
at com.sun.tools.javac.util.Log.setEndPosTable(Log.java:350)
at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:667)
at com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:950)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.<init>(JavacProcessingEnvironment.java:892)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.next(JavacProcessingEnvironment.java:921)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1187)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)
at com.sun.tools.javac.main.Main.compile(Main.java:523)
at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:125)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:169)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:825)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Environment:
JDK version : 1.8.0_51
Maven version : 3.3
Hibernate version : 4.3.7.Final
Snippet from my pom.xml:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>4.3.7.Final</version>
<scope>provided</scope>
</dependency>
Found the Answer!...
It's a bug in 3.2 & 3.3 versions of maven-compiler-plugin.
When I run the 'mvn package' second time, the previously generated source directory is added to the source path before the generate-source phase and it causes this parser exception.
Switching back to the older version (<3.2) of maven-compiler-plugin fixes the issue.
Note that the incremental compilation is broken in 3.0 & 3.1 versions of maven-compiler-plugin. So, I prefer to switch the 2.5.1 version of maven-compiler-plugin.
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
</dependency>
Same issue faced with gradle build as well.
If you have previously metamodel classes available # source-generate(please check the build.gradle file to check the path where your model classes being generated), this issue will come when run gradle build.
Solution : Delete the existing model classes and run gradle build. It should workout.
This bug is fixed in the meantime. You should use maven compiler plugin 3.6 or higher:
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
</dependency>
I have just found another cause of this error: an old version of the maven-processor-plugin (2.1.0 in my case). I got the 'endPosTable already set' even when running mvn clean package. Upgrading the maven-processor-plugin and hibernate-jpamodelgen to the latest versions helped.
I managed to solve this error (happening in CI/CD but was not an issue locally) by removing the maven-processor-plugin. My intelliJ still picks up references to the modelgen classes and only required import of the dependancy
My Maven build fails when using Maven 3.3.1 but is successful with Maven 3.2.2.
So far I have run /path/to/3.3.1/mvn clean compile -X and compared the output to the one produced by /path/to/3.2.2/mvn clean compile -X.
There was exactly one difference in the following block inside the maven-compiler-plugin / default-compile phase:
[DEBUG] Populating class realm plugin>org.apache.maven.plugins:maven-compiler-plugin:3.2
[DEBUG] Included: org.apache.maven.plugins:maven-compiler-plugin:jar:3.2
[DEBUG] Included: com.google.dagger:dagger-compiler:jar:2.0
[DEBUG] Included: com.google.dagger:dagger:jar:2.0
[DEBUG] Included: com.google.dagger:dagger-producers:jar:2.0-beta
[DEBUG] Included: com.google.guava:guava:jar:18.0
...
Difference: While Maven 3.2.2 printed [DEBUG] Included: javax.inject:javax.inject:jar:1, it is missing for Maven 3.3.1.
I don't know if this helps, but this is my effective build plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version> <!-- 3.3 respectively -->
<dependencies>
<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger-compiler</artifactId>
<version>2.0</version>
</dependency>
</dependencies>
<configuration>
<source>1.8</source>
<target>1.8</target>
<!-- workaround for http://jira.codehaus.org/browse/MCOMPILER-202 -->
<forceJavacCompilerUse>true</forceJavacCompilerUse>
</configuration>
</plugin>
What I don't understand: What exactly does the "Populating class realm plugin" do? Why is a jar missing, even though it has been identified as a dependency by both maven versions?
Edit: Build fails with this exception:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project ui: Compilation failure -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project ui: Compilation failure
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:913)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
A minimal example project is available on GitHub.
The full output of the failing command is available here.
The problem is not with the version of maven-compiler-plugin.
When you use the option forceJavacCompilerUse it would basically use javax.tool API implementation within your JDK.
Since you are using dagger-compiler, which is intern dependent on javax.inject, it should get pulled.
You can try adding [provided] scope for your dagger-compiler plugin dependency, this way you would be locking all the transitive dependencies.
Also make sure that you have added dagger
dependency in your runtime dependencies.
Please provide the some more details of exception-stack-trace and other related areas of your pom that would help visitors to narrow-down the problem and guide you quick!
I have a maven project A, with 4 submodules. I have another maven project B, without any submodules. One of the 4 submodules of A, references project B.
When I do clean install on project A, I receive an error message:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project dca-web: Failed to copy file for artifact [be.vlaanderen.dwse:dwse-doc-tools:jar:3.2.2:compile]: /Users/Fabrizio/ontwikkeling/projecten/doc-tools/target/classes (Is a directory)
When enabling debug information: it is clear what is the issue:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project dca-web: Failed to copy file for artifact [be.vlaanderen.dwse:dwse-doc-tools:jar:3.2.2:compile]: /Users/Fabrizio/ontwikkeling/projecten/doc-tools/target/classes (Is a directory) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project dca-web: Failed to copy file for artifact [be.vlaanderen.dwse:dwse-doc-tools:jar:3.2.2:compile]
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to copy file for artifact [be.vlaanderen.dwse:dwse-doc-tools:jar:3.2.2:compile]
at org.apache.maven.plugin.war.packaging.ArtifactsPackagingTask.performPackaging(ArtifactsPackagingTask.java:131)
at org.apache.maven.plugin.war.packaging.WarProjectPackagingTask.handleArtifacts(WarProjectPackagingTask.java:190)
at org.apache.maven.plugin.war.packaging.WarProjectPackagingTask.performPackaging(WarProjectPackagingTask.java:109)
at org.apache.maven.plugin.war.AbstractWarMojo.buildWebapp(AbstractWarMojo.java:472)
at org.apache.maven.plugin.war.AbstractWarMojo.buildExplodedWebapp(AbstractWarMojo.java:404)
at org.apache.maven.plugin.war.WarMojo.performPackaging(WarMojo.java:215)
at org.apache.maven.plugin.war.WarMojo.execute(WarMojo.java:177)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: java.io.FileNotFoundException: /Users/Fabrizio/ontwikkeling/projecten/doc-tools/target/classes (Is a directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:138)
at org.codehaus.plexus.util.io.FileInputStreamFacade.getInputStream(FileInputStreamFacade.java:36)
at org.codehaus.plexus.util.FileUtils.copyStreamToFile(FileUtils.java:1141)
at org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:1048)
at org.apache.maven.plugin.war.packaging.AbstractWarPackagingTask.copyFile(AbstractWarPackagingTask.java:293)
at org.apache.maven.plugin.war.packaging.AbstractWarPackagingTask$1.registered(AbstractWarPackagingTask.java:150)
at org.apache.maven.plugin.war.util.WebappStructure.registerFile(WebappStructure.java:211)
at org.apache.maven.plugin.war.packaging.AbstractWarPackagingTask.copyFile(AbstractWarPackagingTask.java:145)
at org.apache.maven.plugin.war.packaging.ArtifactsPackagingTask.performPackaging(ArtifactsPackagingTask.java:106)
But the folder target/classes is a directory! So there is a bug somewhere in one of the maven plugins I guess...
When I close project B, there is no problem. So opening the referenced project creates an issue...
I need to have project B open, because I use project A as a web application in Tomcat. When I have project B open and i change a file and save it, Eclipse does an incremental publish, and therefore Tomcat doesn't need to redeploy or restart! This saves me for each file change like 30 seconds! So it is very important to keep this project open...
I found the solution. Apparently eclipse luna (or any eclipse luna based ide) is using an embedded version of maven, which in turn uses the maven-war-plugin version 2.2. After adding in my pom the version 2.6, it solved the issue!
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
</plugin>
</plugins>
</build>
The I am attempting to use my custom Maven plugin in a completely new system. It appears to not resolving the parent POM used by the custom Maven plugin.
I have tried several things but I am at a loss.
Any insight would be greatly appreciated. Thank you.
Update
This is is very strange.... this error only occurs when I clean my local repository (simulating a clean system such as a new developer or integration system). If I run the 'mvn -U install' command immediately again (without changing the command at all) then it builds successfully!
This screams 'transitive dependency' but how do I find such an infraction?
Update
I am thinking that this is a bug in Maven. The reactor doesn't find the parent POM even though it is located in the same project! What do you all think?
Custom Plugin POM:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>my.org</groupId>
<artifactId>parent-java-with-foundation</artifactId>
<version>11.1.1.8-SNAPSHOT</version>
<relativePath></relativePath>
</parent>
<groupId>my.org.maven</groupId>
<artifactId>maven-plugin</artifactId>
<version>11.1.1.8-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
</project>
Error Trace:
[ERROR] Plugin my.org.maven:maven-plugin:11.1.1.8-SNAPSHOT or one of its dependencies could not be resolved: Failed to read artifact descriptor for my.org.maven:maven-plugin:jar:11.1.1.8-SNAPSHOT: Could not find artifact my.org:parent-java-with-foundation:pom:11.1.1.8-SNAPSHOT -> [Help 1] org.apache.maven.plugin.PluginResolutionException: Plugin my.org.maven:maven-plugin:11.1.1.8-SNAPSHOT or one of its dependencies could not be resolved: Failed to read artifact descriptor for my.org.maven:maven-plugin:jar:11.1.1.8-SNAPSHOT
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:122)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getPluginDescriptor(DefaultMavenPluginManager.java:146)
at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getMojoDescriptor(DefaultMavenPluginManager.java:265)
at org.apache.maven.plugin.DefaultBuildPluginManager.getMojoDescriptor(DefaultBuildPluginManager.java:190)
at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecution(DefaultLifecycleExecutionPlanCalculator.java:157)
at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.setupMojoExecutions(DefaultLifecycleExecutionPlanCalculator.java:144)
at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:121)
at org.apache.maven.lifecycle.internal.DefaultLifecycleExecutionPlanCalculator.calculateExecutionPlan(DefaultLifecycleExecutionPlanCalculator.java:134)
at org.apache.maven.lifecycle.internal.BuilderCommon.resolveBuildPlan(BuilderCommon.java:92)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for my.org.maven:maven-plugin:jar:11.1.1.8-SNAPSHOT
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:370)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:217)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:288)
at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolve(DefaultPluginDependenciesResolver.java:108)
... 25 more
Caused by: org.apache.maven.model.resolution.UnresolvableModelException: Could not find artifact my.org:parent-java-with-foundation:pom:11.1.1.8-SNAPSHOT
at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:126)
at org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:817)
at org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:669)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:307)
at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:361)
... 28 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact my.org:parent-java-with-foundation:pom:11.1.1.8-SNAPSHOT
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:459)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:262)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:239)
at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:122)
... 32 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact my.org:parent-java-with-foundation:pom:11.1.1.8-SNAPSHOT
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:449)
... 35 more
There can be several reasons for this. If the parent POM isn't part of the reactor (= the current build) and you deleted your local cache, then Maven has to find it somewhere.
If you have a company wide repository, make sure that this version is available from there. Make especially sure that you can download SNAPSHOT versions (some repos can disable that plus you can configure Maven never to download snapshots from certain repos).
If you don't have a company wide repository, then you need to run mvn install in the parent project, first. Maven doesn't try to find missing pieces anywhere on your hard disk.