Re: DependencyResolutionException when upgrading from Maven 2.2.1 to Maven 3.0.4
Just want to thank you all -- Stephen, Jörg, Wayne, John, Mike -- for your help. From your comments, it looks like there are some non-ideal ways my pom.xml files have been set up. Getting all this fixed up to switch to Maven 3 is out of scope for our team at the moment, but I'm going to save all your comments so we have a good starting point when we can get back to this upgrade. Thanks again for your help.
Re: DependencyResolutionException when upgrading from Maven 2.2.1 to Maven 3.0.4
I was able to compile with no problems on 2.2.1. The only pom.xml changes I had to make to get this (almost) working on 3.0.4 was to add version numbers for plugins that didn't have them specified, move plugins under reporting/reporting into build/build, and run mvn -N install on the parent pom -- although that's what I'm trying to avoid. I don't know if the issues you're running into are related, or caused by something else. Any thoughts from anyone about either Mike's issues, or mine? Thanks! On Tue, Apr 10, 2012 at 12:37 PM, mike digioia mpd...@gmail.com wrote: Hi, I just posted a similar issue I am having with the same kind of errors. Did you ever get this to compile on the 2.2.1? I have built two machines, one with 2.2.1 and the other one with 3.0.4. I have different problems with each. Main issue with 3.0.4 is it could not locate some of my dependency jars. So I copied them from the 2.2.1 release system. But still issues. The other main issue is using extension to java/javax with the jmdns.jar. So I modified the classes inside this jar to avoid the problem but still have issues. On the 2.2.1 system it does not see my jar, even though it is inside the pom and was successful with the mvn install-file command. On Tue, Apr 10, 2012 at 12:19 PM, Brain Dump braindump2...@gmail.com wrote: Hi everyone, I'm trying to upgrade my project from Maven 2.2.1 to Maven 3.0.4 but am running into problems with a dependency resolution. I spent a full day trying to research this by looking through Maven documentation and similar posts, but I'm still stuck. I posted on stackoverflow ( http://stackoverflow.com/q/10092772/1324379) but realized that this Maven User List might be a better place to ask for help. Hope that's okay, and thanks in advance for your help. My project structure is as follows: pom.xml (acme-parent) child-alpha +- pom.xml In addition, I have the following files in my own repository: http://maven.my-own-repo.com/acme/child-dep-jdk15/maven-metadata-local.xml http://maven.my-own-repo.com/acme/child-dep-jdk15/1.0/child-dep-jdk15-1.0.jar http://maven.my-own-repo.com/acme/child-dep-jdk15/1.0/child-dep-jdk15-1.0.pom child-alpha/pom.xml in turn has a profile dependency on my own acme:child-dep-jdk15, which has been separately built into a jar file and has its own .pom file specifying a parent that is the same acme-parent parent as child-alpha. Here are excerpts from the relevant files: acme-parent pom.xml: ?xml version=1.0 encoding=UTF-8? project modelVersion4.0.0/modelVersion groupIdacme/groupId artifactIdacme-parent/artifactId nameAcme Parent Project/name version1/version packagingpom/packaging properties.../properties modules modulechild-alpha/module /modules repositories repository idacme-repo/id urlhttp://maven.my-own-repo.com/url /repository repository idcentral/id urlhttp://repo1.maven.org/maven2/url /repository /repositories pluginRepositories.../pluginRepositories build plugins.../plugins /build dependencies.../dependencies /project child-alpha pom.xml: project modelVersion4.0.0/modelVersion parent groupIdacme/groupId artifactIdacme-parent/artifactId version1/version /parent artifactIdchild-alpha/artifactId nameChild Alpha Project/name version1.0/version packagingjar/packaging scm.../scm properties.../properties build resources.../resources plugins.../plugins /build profiles profile idjdk15/id activation activeByDefaulttrue/activeByDefault jdk1.5/jdk /activation dependencies dependency groupIdacme/groupId artifactIdchild-dep-jdk15/artifactId version1.0/version /dependency /dependencies /profile /profiles dependencies.../dependencies /project child-dep-jdk15-1.0.pom: project modelVersion4.0.0/modelVersion parent groupIdacme/groupId artifactIdacme-parent/artifactId version1/version /parent groupIdacme/groupId artifactIdchild-dep-jdk15/artifactId nameAcme Child Dependency/name version1.0/version packagingjar/packaging build.../build dependencies.../dependencies /project
Re: DependencyResolutionException when upgrading from Maven 2.2.1 to Maven 3.0.4
Hey -- sorry about the information overload. I've seen other posts on other forums where people posted too little information and were asked to post their source code or run something on full debug, etc., so I tried to be complete. Didn't mean to overwhelm, and thanks for the responses. Simply said, the dependency child-dep-jdk15 was handled without a problem in Maven 2.2.1 but its presence causes Maven 3.0.4 to look for the parent POM in remote repositories. Both child-alpha and child-dep-jdk15 have the same parent. The dependency child-dep-jdk15 was separately compiled and available on our own remote repository. I did try adding relativePath../pom.xml/relativePath to the parent section of child-alpha, and that had no effect. The only two things that I've managed to do to get the build to succeed is to (1) remove the dependency listed within profiles/profiles of child-alpha, or (2) first run mvn -N install on the parent first. So it seems that the presence of the dependency is what's causing the problem, but I don't understand why. (I haven't tried starting from scratch yet.) Neither option above is okay because I need that dependency, and running mvn -N install would be complicated for branching and our continuous integration server. *From: *Wayne Fay wayne...@gmail.com *To: *Maven Users List users@maven.apache.org *Sent: *Wednesday, April 11, 2012 8:21:44 AM *Subject: *Re: DependencyResolutionException when upgrading from Maven 2.2.1 to Maven 3.0.4 Any thoughts from anyone about either Mike's issues, or mine? Can you boil it down to 5 sentences? I gave up and I'm sure everyone else did too. Sorry but that was just total information overload. Wayne On Wed, Apr 11, 2012 at 8:27 AM, John Patrick nhoj.patr...@gmail.comwrote: Or start from scratch with simple pom.xml and nothing in src, then add src and fix dependencies, build up slowly then diff the resulting pom and see what's different. On 11 April 2012 16:25, John Patrick nhoj.patr...@gmail.com wrote: If you add relativePath../pom.xml/relativePath Into the parent section of child-alpha, does it resolve any issue your having? Specifically with having to do mvn -N install on the parent 1st.
Re: DependencyResolutionException when upgrading from Maven 2.2.1 to Maven 3.0.4
Just to see if it would work, I moved the child-dep-jdk15 dependency out of profiles and moved it into dependencies/dependencies (outside of profiles). It still fails with the same stack trace. Any idea why? I can get the build to pass if I leave out that dependency altogether, but that's not really an option without significant code rewriting. I'm also curious about why including a dependency in a profile is not a good idea (as is using profiles at all). I'm working on a large codebase and would need to explain to the rest of the team before making such changes. Where can I read up on best practices about this? On Wed, Apr 11, 2012 at 1:29 PM, Wayne Fay wayne...@gmail.com wrote: I've managed to do to get the build to succeed is to (1) remove the dependency listed within profiles/profiles of child-alpha, or (2) first For a ton of reasons, including a dependency in a profile is a really terrible thing to do. The very first thing I would do would be to remove it. In fact, I'd do everything I could to remove the use of profiles from your build entirely. Wayne - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
DependencyResolutionException when upgrading from Maven 2.2.1 to Maven 3.0.4
Hi everyone, I'm trying to upgrade my project from Maven 2.2.1 to Maven 3.0.4 but am running into problems with a dependency resolution. I spent a full day trying to research this by looking through Maven documentation and similar posts, but I'm still stuck. I posted on stackoverflow ( http://stackoverflow.com/q/10092772/1324379) but realized that this Maven User List might be a better place to ask for help. Hope that's okay, and thanks in advance for your help. My project structure is as follows: pom.xml (acme-parent) child-alpha +- pom.xml In addition, I have the following files in my own repository: http://maven.my-own-repo.com/acme/child-dep-jdk15/maven-metadata-local.xml http://maven.my-own-repo.com/acme/child-dep-jdk15/1.0/child-dep-jdk15-1.0.jar http://maven.my-own-repo.com/acme/child-dep-jdk15/1.0/child-dep-jdk15-1.0.pom child-alpha/pom.xml in turn has a profile dependency on my own acme:child-dep-jdk15, which has been separately built into a jar file and has its own .pom file specifying a parent that is the same acme-parent parent as child-alpha. Here are excerpts from the relevant files: acme-parent pom.xml: ?xml version=1.0 encoding=UTF-8? project modelVersion4.0.0/modelVersion groupIdacme/groupId artifactIdacme-parent/artifactId nameAcme Parent Project/name version1/version packagingpom/packaging properties.../properties modules modulechild-alpha/module /modules repositories repository idacme-repo/id urlhttp://maven.my-own-repo.com/url /repository repository idcentral/id urlhttp://repo1.maven.org/maven2/url /repository /repositories pluginRepositories.../pluginRepositories build plugins.../plugins /build dependencies.../dependencies /project child-alpha pom.xml: project modelVersion4.0.0/modelVersion parent groupIdacme/groupId artifactIdacme-parent/artifactId version1/version /parent artifactIdchild-alpha/artifactId nameChild Alpha Project/name version1.0/version packagingjar/packaging scm.../scm properties.../properties build resources.../resources plugins.../plugins /build profiles profile idjdk15/id activation activeByDefaulttrue/activeByDefault jdk1.5/jdk /activation dependencies dependency groupIdacme/groupId artifactIdchild-dep-jdk15/artifactId version1.0/version /dependency /dependencies /profile /profiles dependencies.../dependencies /project child-dep-jdk15-1.0.pom: project modelVersion4.0.0/modelVersion parent groupIdacme/groupId artifactIdacme-parent/artifactId version1/version /parent groupIdacme/groupId artifactIdchild-dep-jdk15/artifactId nameAcme Child Dependency/name version1.0/version packagingjar/packaging build.../build dependencies.../dependencies /project When I tried to build child-alpha (while in the child-alpha directory), I ran the following command: mvn -U -e clean install And I got the following log messages and stack trace (extraneous messages removed): Downloading: http://maven2.my-own-repo.com/acme/acme-parent/1/acme-parent-1.pom Downloading: http://repo1.maven.org/maven2/acme/acme-parent/1/acme-parent-1.pom [...] [ERROR] Failed to execute goal on project child-alpha: Could not resolve dependencies for project acme:child-alpha:jar:1.0: [...] Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project acme:child-alpha:jar:1.0: [...] Caused by: org.sonatype.aether.collection.DependencyCollectionException: Failed to collect dependencies for [...] at org.sonatype.aether.impl.internal.DefaultDependencyCollector.collectDependencies(DefaultDependencyCollector.java:258) at org.sonatype.aether.impl.internal.DefaultRepositorySystem.collectDependencies(DefaultRepositorySystem.java:308) at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:150) ... 23 more Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for acme:child-dep-jdk15:jar:1.0 at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:331) at