Re: Classpath ordering of dependencies
Ok, I didn't know about that feature of the enforcer plugin. I actually created a new jira issue suggesting a top level exclusion so that certain transitive dependencies could be globally excluded. http://jira.codehaus.org/browse/MNG-3196 Otherwise, it can be a pain to track down a bad transitive dependency if it is included in several places in the tree. Brian E. Fox wrote: And you can use the enforcer noBannedDependency rule to make sure it doesn't come back. Take a look at the dependency plugin pom to see how I used it because the containerApi kept sneaking in. -Original Message- From: Wayne Fay [mailto:[EMAIL PROTECTED] Sent: Sunday, September 09, 2007 9:50 PM To: Maven Developers List Subject: Re: Classpath ordering of dependencies It also sounds like perhaps you need an excludes in your dependency declaration, to get rid of that "bad" transitive dep. Wayne On 7 Sep 07, at 2:20 PM 7 Sep 07, Paul Gier wrote: I did a little more research, and it looks like the artifact was renamed, so maven didn't know they were the same artifact. For an example, if you create a project with a direct dependency on antlr:antlr:3.0b5 and have a transitive dependency on antlr:antlr: 2.7.1, you will get the 2.7.1 version in the classpath first because 3.0b5 has been renamed to groupId "org.antlr" When the groupId and artifactId are the same, then maven does the right thing and removed the transitive dependency. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Classpath ordering of dependencies
And you can use the enforcer noBannedDependency rule to make sure it doesn't come back. Take a look at the dependency plugin pom to see how I used it because the containerApi kept sneaking in. -Original Message- From: Wayne Fay [mailto:[EMAIL PROTECTED] Sent: Sunday, September 09, 2007 9:50 PM To: Maven Developers List Subject: Re: Classpath ordering of dependencies It also sounds like perhaps you need an excludes in your dependency declaration, to get rid of that "bad" transitive dep. Wayne > On 7 Sep 07, at 2:20 PM 7 Sep 07, Paul Gier wrote: > > > I did a little more research, and it looks like the artifact was > > renamed, so maven didn't know they were the same artifact. For an > > example, if you create a project with a direct dependency on > > antlr:antlr:3.0b5 and have a transitive dependency on antlr:antlr: > > 2.7.1, you will get the 2.7.1 version in the classpath first > > because 3.0b5 has been renamed to groupId "org.antlr" > > > > When the groupId and artifactId are the same, then maven does the > > right thing and removed the transitive dependency. > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Classpath ordering of dependencies
It also sounds like perhaps you need an excludes in your dependency declaration, to get rid of that "bad" transitive dep. Wayne > On 7 Sep 07, at 2:20 PM 7 Sep 07, Paul Gier wrote: > > > I did a little more research, and it looks like the artifact was > > renamed, so maven didn't know they were the same artifact. For an > > example, if you create a project with a direct dependency on > > antlr:antlr:3.0b5 and have a transitive dependency on antlr:antlr: > > 2.7.1, you will get the 2.7.1 version in the classpath first > > because 3.0b5 has been renamed to groupId "org.antlr" > > > > When the groupId and artifactId are the same, then maven does the > > right thing and removed the transitive dependency. > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Classpath ordering of dependencies
On 7 Sep 07, at 2:20 PM 7 Sep 07, Paul Gier wrote: Jason van Zyl wrote: On 7 Sep 07, at 9:43 AM 7 Sep 07, Paul Gier wrote: Hi Everyone, I noticed that transitive dependencies seem to precede direct dependencies on the test classpath. I created this issue related to this: http://jira.codehaus.org/browse/MNG-3197 Is this behaviour by design? No. This is not good as it provides no control over ordering when you need it. I've already run into serious issues with migrations where you have very little control when you need it. In the current maven, this means that if there is an older version of one of your direct dependencies in the transitive dep tree of another dependency, the older version will be used by the test code. This can be confusing when a test fails because the test is using an old version of one of the dependencies listed in the pom. It seems like it would make more sense if the direct dependencies take priority over transitive dependencies, but maybe there is some reason for this. If not, I will start working on a patch to reverse the classpath ordering. No, what you list should be first, that only makes sense and artifacts should not be duplicated. You are finding you're getting two copies of foo-XXX.jar? I did a little more research, and it looks like the artifact was renamed, so maven didn't know they were the same artifact. For an example, if you create a project with a direct dependency on antlr:antlr:3.0b5 and have a transitive dependency on antlr:antlr: 2.7.1, you will get the 2.7.1 version in the classpath first because 3.0b5 has been renamed to groupId "org.antlr" When the groupId and artifactId are the same, then maven does the right thing and removed the transitive dependency. So does it still make sense to reverse the generated classpath ordering so that direct dependencies come first? Absolutely. It's not right that the user has no control. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Thanks, Jason -- Jason van Zyl Founder and PMC Chair, Apache Maven jason at sonatype dot com -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Classpath ordering of dependencies
Jason van Zyl wrote: On 7 Sep 07, at 9:43 AM 7 Sep 07, Paul Gier wrote: Hi Everyone, I noticed that transitive dependencies seem to precede direct dependencies on the test classpath. I created this issue related to this: http://jira.codehaus.org/browse/MNG-3197 Is this behaviour by design? No. This is not good as it provides no control over ordering when you need it. I've already run into serious issues with migrations where you have very little control when you need it. In the current maven, this means that if there is an older version of one of your direct dependencies in the transitive dep tree of another dependency, the older version will be used by the test code. This can be confusing when a test fails because the test is using an old version of one of the dependencies listed in the pom. It seems like it would make more sense if the direct dependencies take priority over transitive dependencies, but maybe there is some reason for this. If not, I will start working on a patch to reverse the classpath ordering. No, what you list should be first, that only makes sense and artifacts should not be duplicated. You are finding you're getting two copies of foo-XXX.jar? I did a little more research, and it looks like the artifact was renamed, so maven didn't know they were the same artifact. For an example, if you create a project with a direct dependency on antlr:antlr:3.0b5 and have a transitive dependency on antlr:antlr:2.7.1, you will get the 2.7.1 version in the classpath first because 3.0b5 has been renamed to groupId "org.antlr" When the groupId and artifactId are the same, then maven does the right thing and removed the transitive dependency. So does it still make sense to reverse the generated classpath ordering so that direct dependencies come first? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Classpath ordering of dependencies
On 7 Sep 07, at 9:43 AM 7 Sep 07, Paul Gier wrote: Hi Everyone, I noticed that transitive dependencies seem to precede direct dependencies on the test classpath. I created this issue related to this: http://jira.codehaus.org/browse/MNG-3197 Is this behaviour by design? No. This is not good as it provides no control over ordering when you need it. I've already run into serious issues with migrations where you have very little control when you need it. In the current maven, this means that if there is an older version of one of your direct dependencies in the transitive dep tree of another dependency, the older version will be used by the test code. This can be confusing when a test fails because the test is using an old version of one of the dependencies listed in the pom. It seems like it would make more sense if the direct dependencies take priority over transitive dependencies, but maybe there is some reason for this. If not, I will start working on a patch to reverse the classpath ordering. No, what you list should be first, that only makes sense and artifacts should not be duplicated. You are finding you're getting two copies of foo-XXX.jar? Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Thanks, Jason -- Jason van Zyl Founder and PMC Chair, Apache Maven jason at sonatype dot com -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]