You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Christian Schulte <cs...@schulte.it> on 2016/07/01 07:16:47 UTC

Plugin resolution for Maven 3.5

Hi,

I am currently stumbling upon the following issue. Maven resolves
plugins as if they were a direct dependency of Maven core. That means it
will not consider any 'test' or 'provided' scope dependencies of plugins
when building plugin runtime classpaths. I am not sure if this is the
correct way to go. If it would resolve plugins the same way it resolves
projects, things like the following will start to happen.

Execution default-resources of goal
org.apache.maven.plugins:maven-resources-plugin:3.0.1:resources failed:
A required class was missing while executing
org.apache.maven.plugins:maven-resources-plugin:3.0.1:resources:
org/apache/commons/io/input/XmlStreamReader

Caused by: java.lang.ClassNotFoundException:
org.apache.commons.io.input.XmlStreamReader

Here is the plugin's classpath resolved by Maven <= 3.4.0-SNAPSHOT:

 [DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=4,
ConflictMarker.markTime=4, ConflictMarker.nodeCount=69,
ConflictIdSorter.graphTime=2, ConflictIdSorter.topsortTime=1,
ConflictIdSorter.conflictIdCount=28,
ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=17,
ConflictResolver.conflictItemCount=68,
DefaultDependencyCollector.collectTime=850,
DefaultDependencyCollector.transformTime=36}
[DEBUG] org.apache.maven.plugins:maven-resources-plugin:jar:3.0.1:
[DEBUG]    org.apache.maven:maven-plugin-api:jar:3.0:compile
[DEBUG]       org.sonatype.sisu:sisu-inject-plexus:jar:1.4.2:compile
[DEBUG]          org.sonatype.sisu:sisu-inject-bean:jar:1.4.2:compile
[DEBUG]             org.sonatype.sisu:sisu-guice:jar:noaop:2.1.7:compile
[DEBUG]    org.apache.maven:maven-core:jar:3.0:compile
[DEBUG]       org.apache.maven:maven-settings-builder:jar:3.0:compile
[DEBUG]       org.apache.maven:maven-repository-metadata:jar:3.0:compile
[DEBUG]       org.apache.maven:maven-model-builder:jar:3.0:compile
[DEBUG]       org.apache.maven:maven-aether-provider:jar:3.0:runtime
[DEBUG]       org.sonatype.aether:aether-impl:jar:1.7:compile
[DEBUG]          org.sonatype.aether:aether-spi:jar:1.7:compile
[DEBUG]       org.sonatype.aether:aether-api:jar:1.7:compile
[DEBUG]       org.sonatype.aether:aether-util:jar:1.7:compile
[DEBUG]       org.codehaus.plexus:plexus-classworlds:jar:2.2.3:compile
[DEBUG]
org.codehaus.plexus:plexus-component-annotations:jar:1.6:compile
[DEBUG]       org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3:compile
[DEBUG]          org.sonatype.plexus:plexus-cipher:jar:1.4:compile
[DEBUG]    org.apache.maven:maven-artifact:jar:3.0:compile
[DEBUG]    org.apache.maven:maven-settings:jar:3.0:compile
[DEBUG]    org.apache.maven:maven-model:jar:3.0:compile
[DEBUG]    org.codehaus.plexus:plexus-utils:jar:3.0.24:compile
[DEBUG]    org.apache.maven.shared:maven-filtering:jar:3.1.1:compile
[DEBUG]       org.apache.maven.shared:maven-shared-utils:jar:3.0.0:compile
[DEBUG]          commons-io:commons-io:jar:2.4:compile
[DEBUG]          com.google.code.findbugs:jsr305:jar:2.0.1:compile
[DEBUG]       org.sonatype.plexus:plexus-build-api:jar:0.0.7:compile
[DEBUG]    org.codehaus.plexus:plexus-interpolation:jar:1.22:compile

And here is the plugin's classpath resolved the same way projects are
resolved (3.5.0-SNAPSHOT):

[DEBUG] Dependency collection stats:
{ConflictMarker.analyzeTime=3907145, ConflictMarker.markTime=5714366,
ConflictMarker.nodeCount=172, ConflictIdSorter.graphTime=2411000,
ConflictIdSorter.topsortTime=1248278,
ConflictIdSorter.conflictIdCount=38,
ConflictIdSorter.conflictIdCycleCount=0,
ConflictResolver.totalTime=21802925,
ConflictResolver.conflictItemCount=90,
DefaultDependencyCollector.collectTime=1324192650,
DefaultDependencyCollector.transformTime=190157370}
[DEBUG] org.apache.maven.plugins:maven-resources-plugin:jar:3.0.1:
[DEBUG]    org.apache.maven:maven-plugin-api:jar:3.0:compile
[DEBUG]       org.sonatype.sisu:sisu-inject-plexus:jar:1.4.2:compile
[DEBUG]          org.sonatype.sisu:sisu-inject-bean:jar:1.4.2:compile
[DEBUG]             org.sonatype.sisu:sisu-guice:jar:noaop:2.1.7:compile
[DEBUG]    org.apache.maven:maven-core:jar:3.0:compile
[DEBUG]       org.apache.maven:maven-settings-builder:jar:3.0:compile
[DEBUG]       org.apache.maven:maven-repository-metadata:jar:3.0:compile
[DEBUG]       org.apache.maven:maven-model-builder:jar:3.0:compile
[DEBUG]       org.apache.maven:maven-aether-provider:jar:3.0:runtime
[DEBUG]       org.sonatype.aether:aether-impl:jar:1.7:compile
[DEBUG]          org.sonatype.aether:aether-spi:jar:1.7:compile
[DEBUG]       org.sonatype.aether:aether-api:jar:1.7:compile
[DEBUG]       org.sonatype.aether:aether-util:jar:1.7:compile
[DEBUG]       org.codehaus.plexus:plexus-classworlds:jar:2.2.3:compile
[DEBUG]
org.codehaus.plexus:plexus-component-annotations:jar:1.6:compile
[DEBUG]       org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3:compile
[DEBUG]          org.sonatype.plexus:plexus-cipher:jar:1.4:compile
[DEBUG]    org.apache.maven:maven-artifact:jar:3.0:compile
[DEBUG]    org.apache.maven:maven-settings:jar:3.0:compile
[DEBUG]    org.apache.maven:maven-model:jar:3.0:compile
[DEBUG]
org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.4:provided
[DEBUG]    org.codehaus.plexus:plexus-utils:jar:3.0.24:compile
[DEBUG]    org.apache.maven.shared:maven-filtering:jar:3.1.1:compile
[DEBUG]       org.apache.maven.shared:maven-shared-utils:jar:3.0.0:compile
[DEBUG]          com.google.code.findbugs:jsr305:jar:2.0.1:compile
[DEBUG]       org.sonatype.plexus:plexus-build-api:jar:0.0.7:compile
[DEBUG]    org.codehaus.plexus:plexus-interpolation:jar:1.22:compile
[DEBUG]    org.apache.maven:maven-compat:jar:3.0:test
[DEBUG]       org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-6:test
[DEBUG]
org.apache.maven.plugin-testing:maven-plugin-testing-harness:jar:2.1:test
[DEBUG]       org.codehaus.plexus:plexus-archiver:jar:2.2:test
[DEBUG]
org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:test
[DEBUG]             classworlds:classworlds:jar:1.1-alpha-2:test
[DEBUG]          org.codehaus.plexus:plexus-io:jar:2.0.4:test
[DEBUG]    commons-io:commons-io:jar:2.5:test
[DEBUG]    junit:junit:jar:4.12:test
[DEBUG]       org.hamcrest:hamcrest-core:jar:1.3:test

As you can see, the last classpath contains the direct 'test'
dependencies of the plugin. I think that is correct, btw. The reason
Maven will throw a ClassNotFoundException that way is the way the
plugin's dependencies have been set up.

The POM of the plugin contains 'commons-io:commons-io:jar:2.5:test'. If
the 'test' scope dependencies are not considered during resolution (as
it is), Maven will pull in 'commons-io:commons-io:jar:2.4:compile'
because that is a transitive dependency of
'org.apache.maven.shared:maven-filtering:jar:3.1.1:compile'. Just
compare the two classpath from where 'commons-io' is pulled in.

Simple question we would need to discuss. Would you say the plugin's POM
is incorrect because it contains that
'commons-io:commons-io:jar:2.5:test' dependency although that dependency
really should be a 'compile' dependency? If it would not be a plugin but
a library to depend on, we would all agree that the POM is incorrect. So
I would say it is a bug because if you were to write a reusable "base"
plugin to extend from (one of the reasons to use annotations), it would
break the build for plugins depending on that "base" plugin.

Regards,
-- 
Christian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Plugin resolution for Maven 3.5

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi,

On 7/1/16 9:03 PM, Christian Schulte wrote:
> Am 07/01/16 um 20:11 schrieb Karl Heinz Marbaise:
>> Hi,
>>
>> wouldn't it make sense to create a branch for Maven 3.5.0 ? And
>> summarize all changes there ? Makes it more clear ?
>>
>> Cause there are some issues fixed related to JIRA...for 3.5.0 ?
>>
>> WDYT ?
>>
>>
>
> Already done. That's the MNG-6006 branch.

couldn't we name it 3.5.0 ?

Kind regards
Karl Heinz

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Plugin resolution for Maven 3.5

Posted by Christian Schulte <cs...@schulte.it>.
Am 07/01/16 um 20:11 schrieb Karl Heinz Marbaise:
> Hi,
> 
> wouldn't it make sense to create a branch for Maven 3.5.0 ? And 
> summarize all changes there ? Makes it more clear ?
> 
> Cause there are some issues fixed related to JIRA...for 3.5.0 ?
> 
> WDYT ?
> 
> 

Already done. That's the MNG-6006 branch.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Plugin resolution for Maven 3.5

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi,

wouldn't it make sense to create a branch for Maven 3.5.0 ? And 
summarize all changes there ? Makes it more clear ?

Cause there are some issues fixed related to JIRA...for 3.5.0 ?

WDYT ?


Kind regards
Karl Heinz Marbaise

On 7/1/16 9:16 AM, Christian Schulte wrote:
> Hi,
>
> I am currently stumbling upon the following issue. Maven resolves
> plugins as if they were a direct dependency of Maven core. That means it
> will not consider any 'test' or 'provided' scope dependencies of plugins
> when building plugin runtime classpaths. I am not sure if this is the
> correct way to go. If it would resolve plugins the same way it resolves
> projects, things like the following will start to happen.
>
> Execution default-resources of goal
> org.apache.maven.plugins:maven-resources-plugin:3.0.1:resources failed:
> A required class was missing while executing
> org.apache.maven.plugins:maven-resources-plugin:3.0.1:resources:
> org/apache/commons/io/input/XmlStreamReader
>
> Caused by: java.lang.ClassNotFoundException:
> org.apache.commons.io.input.XmlStreamReader
>
> Here is the plugin's classpath resolved by Maven <= 3.4.0-SNAPSHOT:
>
>  [DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=4,
> ConflictMarker.markTime=4, ConflictMarker.nodeCount=69,
> ConflictIdSorter.graphTime=2, ConflictIdSorter.topsortTime=1,
> ConflictIdSorter.conflictIdCount=28,
> ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=17,
> ConflictResolver.conflictItemCount=68,
> DefaultDependencyCollector.collectTime=850,
> DefaultDependencyCollector.transformTime=36}
> [DEBUG] org.apache.maven.plugins:maven-resources-plugin:jar:3.0.1:
> [DEBUG]    org.apache.maven:maven-plugin-api:jar:3.0:compile
> [DEBUG]       org.sonatype.sisu:sisu-inject-plexus:jar:1.4.2:compile
> [DEBUG]          org.sonatype.sisu:sisu-inject-bean:jar:1.4.2:compile
> [DEBUG]             org.sonatype.sisu:sisu-guice:jar:noaop:2.1.7:compile
> [DEBUG]    org.apache.maven:maven-core:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-settings-builder:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-repository-metadata:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-model-builder:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-aether-provider:jar:3.0:runtime
> [DEBUG]       org.sonatype.aether:aether-impl:jar:1.7:compile
> [DEBUG]          org.sonatype.aether:aether-spi:jar:1.7:compile
> [DEBUG]       org.sonatype.aether:aether-api:jar:1.7:compile
> [DEBUG]       org.sonatype.aether:aether-util:jar:1.7:compile
> [DEBUG]       org.codehaus.plexus:plexus-classworlds:jar:2.2.3:compile
> [DEBUG]
> org.codehaus.plexus:plexus-component-annotations:jar:1.6:compile
> [DEBUG]       org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3:compile
> [DEBUG]          org.sonatype.plexus:plexus-cipher:jar:1.4:compile
> [DEBUG]    org.apache.maven:maven-artifact:jar:3.0:compile
> [DEBUG]    org.apache.maven:maven-settings:jar:3.0:compile
> [DEBUG]    org.apache.maven:maven-model:jar:3.0:compile
> [DEBUG]    org.codehaus.plexus:plexus-utils:jar:3.0.24:compile
> [DEBUG]    org.apache.maven.shared:maven-filtering:jar:3.1.1:compile
> [DEBUG]       org.apache.maven.shared:maven-shared-utils:jar:3.0.0:compile
> [DEBUG]          commons-io:commons-io:jar:2.4:compile
> [DEBUG]          com.google.code.findbugs:jsr305:jar:2.0.1:compile
> [DEBUG]       org.sonatype.plexus:plexus-build-api:jar:0.0.7:compile
> [DEBUG]    org.codehaus.plexus:plexus-interpolation:jar:1.22:compile
>
> And here is the plugin's classpath resolved the same way projects are
> resolved (3.5.0-SNAPSHOT):
>
> [DEBUG] Dependency collection stats:
> {ConflictMarker.analyzeTime=3907145, ConflictMarker.markTime=5714366,
> ConflictMarker.nodeCount=172, ConflictIdSorter.graphTime=2411000,
> ConflictIdSorter.topsortTime=1248278,
> ConflictIdSorter.conflictIdCount=38,
> ConflictIdSorter.conflictIdCycleCount=0,
> ConflictResolver.totalTime=21802925,
> ConflictResolver.conflictItemCount=90,
> DefaultDependencyCollector.collectTime=1324192650,
> DefaultDependencyCollector.transformTime=190157370}
> [DEBUG] org.apache.maven.plugins:maven-resources-plugin:jar:3.0.1:
> [DEBUG]    org.apache.maven:maven-plugin-api:jar:3.0:compile
> [DEBUG]       org.sonatype.sisu:sisu-inject-plexus:jar:1.4.2:compile
> [DEBUG]          org.sonatype.sisu:sisu-inject-bean:jar:1.4.2:compile
> [DEBUG]             org.sonatype.sisu:sisu-guice:jar:noaop:2.1.7:compile
> [DEBUG]    org.apache.maven:maven-core:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-settings-builder:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-repository-metadata:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-model-builder:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-aether-provider:jar:3.0:runtime
> [DEBUG]       org.sonatype.aether:aether-impl:jar:1.7:compile
> [DEBUG]          org.sonatype.aether:aether-spi:jar:1.7:compile
> [DEBUG]       org.sonatype.aether:aether-api:jar:1.7:compile
> [DEBUG]       org.sonatype.aether:aether-util:jar:1.7:compile
> [DEBUG]       org.codehaus.plexus:plexus-classworlds:jar:2.2.3:compile
> [DEBUG]
> org.codehaus.plexus:plexus-component-annotations:jar:1.6:compile
> [DEBUG]       org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3:compile
> [DEBUG]          org.sonatype.plexus:plexus-cipher:jar:1.4:compile
> [DEBUG]    org.apache.maven:maven-artifact:jar:3.0:compile
> [DEBUG]    org.apache.maven:maven-settings:jar:3.0:compile
> [DEBUG]    org.apache.maven:maven-model:jar:3.0:compile
> [DEBUG]
> org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.4:provided
> [DEBUG]    org.codehaus.plexus:plexus-utils:jar:3.0.24:compile
> [DEBUG]    org.apache.maven.shared:maven-filtering:jar:3.1.1:compile
> [DEBUG]       org.apache.maven.shared:maven-shared-utils:jar:3.0.0:compile
> [DEBUG]          com.google.code.findbugs:jsr305:jar:2.0.1:compile
> [DEBUG]       org.sonatype.plexus:plexus-build-api:jar:0.0.7:compile
> [DEBUG]    org.codehaus.plexus:plexus-interpolation:jar:1.22:compile
> [DEBUG]    org.apache.maven:maven-compat:jar:3.0:test
> [DEBUG]       org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-6:test
> [DEBUG]
> org.apache.maven.plugin-testing:maven-plugin-testing-harness:jar:2.1:test
> [DEBUG]       org.codehaus.plexus:plexus-archiver:jar:2.2:test
> [DEBUG]
> org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:test
> [DEBUG]             classworlds:classworlds:jar:1.1-alpha-2:test
> [DEBUG]          org.codehaus.plexus:plexus-io:jar:2.0.4:test
> [DEBUG]    commons-io:commons-io:jar:2.5:test
> [DEBUG]    junit:junit:jar:4.12:test
> [DEBUG]       org.hamcrest:hamcrest-core:jar:1.3:test
>
> As you can see, the last classpath contains the direct 'test'
> dependencies of the plugin. I think that is correct, btw. The reason
> Maven will throw a ClassNotFoundException that way is the way the
> plugin's dependencies have been set up.
>
> The POM of the plugin contains 'commons-io:commons-io:jar:2.5:test'. If
> the 'test' scope dependencies are not considered during resolution (as
> it is), Maven will pull in 'commons-io:commons-io:jar:2.4:compile'
> because that is a transitive dependency of
> 'org.apache.maven.shared:maven-filtering:jar:3.1.1:compile'. Just
> compare the two classpath from where 'commons-io' is pulled in.
>
> Simple question we would need to discuss. Would you say the plugin's POM
> is incorrect because it contains that
> 'commons-io:commons-io:jar:2.5:test' dependency although that dependency
> really should be a 'compile' dependency? If it would not be a plugin but
> a library to depend on, we would all agree that the POM is incorrect. So
> I would say it is a bug because if you were to write a reusable "base"
> plugin to extend from (one of the reasons to use annotations), it would
> break the build for plugins depending on that "base" plugin.
>
> Regards,

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Plugin resolution for Maven 3.5

Posted by Christian Schulte <cs...@schulte.it>.
Am 07/02/16 um 16:59 schrieb Robert Scholte:
> 
> I agree that this should have been commons-io:2.4, but it matches the  
> documentation (g:a is unique and nearest wins). I expect that the problem  
> lies in the way Aether is used.
> I assume that first the complete dependency graph is collected no matter  
> the scope. Next it is resolved so each dependency has the proper scope and  
> version. And finally there's the scope based filtering.
> This order I would like to see it to start with scope filtering. This will  
> probably be more efficient too, since test-scoped dependencies are  
> filtered out from the beginning.
> 

Turned out I have been running maven-resources-plugin-3.0.1 but debugged
maven-resources-plugin-3.0.2-SNAPSHOT. It's a bit different. The compile
classpath does not contain any commons-io. It should contain
commons-io-2.4. So that test dependency gets filtered out from the
compile classpath.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Plugin resolution for Maven 3.5

Posted by Robert Scholte <rf...@apache.org>.
On Sat, 02 Jul 2016 16:31:41 +0200, Christian Schulte <cs...@schulte.it>  
wrote:

> Am 07/02/16 um 15:25 schrieb Robert Scholte:
>> Hi,
>>
>> It is very likely that a previous version of maven-shared-utils did not
>> depend on commons-io, which made it required to specify commons-io with
>> the test-scope for this project.
>
> That's what I assume as well.
>
>> With this in mind it seems weird to me to remove commons-io as a direct
>> test-scoped dependency.
>
> I ment keeping it a direct dependency but updating it's scope to compile
> as it no longer is a test-only dependency.
>
>> If for some reason we don't need maven-shared-utils anymore the tests of
>> this project won't build anymore.
>
> And we will notice we need to add that dependency due to build errors.
>
>> What I would expect to see for the *runtime* plugin classpath are the
>> direct dependencies with scopes compile, runtime and system, and all  
>> their
>> transitive dependencies with the scopes compile, runtime and system.
>> The interesting thing that will happen here is that when testing it'll
>> have commons-io:2.5 on its classpath, whereas at runtime it'll have
>> commons-io:2.4 on its classpath. Based on the docs that can't be right
>> (every dependency can only have one version and one scope) but I think  
>> it
>> is.
>
> That's what I find confusing. What makes me think we should do something
> about it is that there is no way to notice this other than comparing the
> dependency trees manually. If the next upgrade of maven-shared-utils
> pulls in 20 depedencies we all have set to test scope noone will notice
> this because nothing will warn you about that. The same when transitive
> dependencies are removed. The plugin is compiled against commons-io-2.5
> because that is the nearer declaration. At runtime, it will use
> commons-io-2.4. It's just luck the code does not call a method of 2.5
> not available in 2.4. If it would, someone would already have set the
> scope to compile. The following is the compile classpath of
> maven-resources-plugin. It contains 'commons-io-2.5'. That version comes
> from a test dependency. That can't be correct. That test dependency must
> not be on the compile classpath, IMHO. I really think that is a bug.
> Similar to <https://issues.apache.org/jira/browse/MNG-5988>. Aether does
> not destinguish between different classpaths. The test classpath and the
> main classpath really should be isolated / independent of each other.
> The test dependencies may override dependencies from the compile
> classpath during testing but not during compilation. The compile
> classpath of maven-resources-plugin should contain commons-io-2.4
> because it is a transitive dependency of a compile dependency and the
> test classpath should contain commons-io-2.5.
>
> [INFO] Changes detected - recompiling the module!
> [DEBUG] Classpath:
> [DEBUG]
> /home/schulte/Sources/apache.org/plugins/maven-resources-plugin/target/classes
> [DEBUG]
> /home/schulte/.m2/repository/org/apache/maven/maven-plugin-api/3.0/maven-plugin-api-3.0.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/sonatype/sisu/sisu-inject-plexus/1.4.2/sisu-inject-plexus-1.4.2.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/apache/maven/maven-core/3.0/maven-core-3.0.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/apache/maven/maven-settings-builder/3.0/maven-settings-builder-3.0.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/apache/maven/maven-repository-metadata/3.0/maven-repository-metadata-3.0.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/apache/maven/maven-model-builder/3.0/maven-model-builder-3.0.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/sonatype/aether/aether-impl/1.7/aether-impl-1.7.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/sonatype/aether/aether-spi/1.7/aether-spi-1.7.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/sonatype/aether/aether-api/1.7/aether-api-1.7.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/sonatype/aether/aether-util/1.7/aether-util-1.7.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/codehaus/plexus/plexus-classworlds/2.2.3/plexus-classworlds-2.2.3.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.6/plexus-component-annotations-1.6.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/apache/maven/maven-artifact/3.0/maven-artifact-3.0.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/apache/maven/maven-settings/3.0/maven-settings-3.0.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/apache/maven/maven-model/3.0/maven-model-3.0.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-annotations/3.4/maven-plugin-annotations-3.4.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.24/plexus-utils-3.0.24.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/apache/maven/shared/maven-filtering/3.1.1/maven-filtering-3.1.1.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/apache/maven/shared/maven-shared-utils/3.0.0/maven-shared-utils-3.0.0.jar
> [DEBUG]
> /home/schulte/.m2/repository/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/sonatype/plexus/plexus-build-api/0.0.7/plexus-build-api-0.0.7.jar
> [DEBUG]
> /home/schulte/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar
> [DEBUG]
> /home/schulte/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.22/plexus-interpolation-1.22.jar
> [DEBUG] Source roots:
> [DEBUG]
> /home/schulte/Sources/apache.org/plugins/maven-resources-plugin/src/main/java
> [DEBUG]
> /home/schulte/Sources/apache.org/plugins/maven-resources-plugin/target/generated-sources/plugin
> [DEBUG]
> /home/schulte/Sources/apache.org/plugins/maven-resources-plugin/target/generated-sources/annotations
>
>
> Regards,

I agree that this should have been commons-io:2.4, but it matches the  
documentation (g:a is unique and nearest wins). I expect that the problem  
lies in the way Aether is used.
I assume that first the complete dependency graph is collected no matter  
the scope. Next it is resolved so each dependency has the proper scope and  
version. And finally there's the scope based filtering.
This order I would like to see it to start with scope filtering. This will  
probably be more efficient too, since test-scoped dependencies are  
filtered out from the beginning.

Robert

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Plugin resolution for Maven 3.5

Posted by Christian Schulte <cs...@schulte.it>.
Am 07/02/16 um 15:25 schrieb Robert Scholte:
> Hi,
> 
> It is very likely that a previous version of maven-shared-utils did not  
> depend on commons-io, which made it required to specify commons-io with  
> the test-scope for this project.

That's what I assume as well.

> With this in mind it seems weird to me to remove commons-io as a direct  
> test-scoped dependency.

I ment keeping it a direct dependency but updating it's scope to compile
as it no longer is a test-only dependency.

> If for some reason we don't need maven-shared-utils anymore the tests of
> this project won't build anymore.

And we will notice we need to add that dependency due to build errors.

> What I would expect to see for the *runtime* plugin classpath are the  
> direct dependencies with scopes compile, runtime and system, and all their  
> transitive dependencies with the scopes compile, runtime and system.
> The interesting thing that will happen here is that when testing it'll  
> have commons-io:2.5 on its classpath, whereas at runtime it'll have  
> commons-io:2.4 on its classpath. Based on the docs that can't be right  
> (every dependency can only have one version and one scope) but I think it  
> is.

That's what I find confusing. What makes me think we should do something
about it is that there is no way to notice this other than comparing the
dependency trees manually. If the next upgrade of maven-shared-utils
pulls in 20 depedencies we all have set to test scope noone will notice
this because nothing will warn you about that. The same when transitive
dependencies are removed. The plugin is compiled against commons-io-2.5
because that is the nearer declaration. At runtime, it will use
commons-io-2.4. It's just luck the code does not call a method of 2.5
not available in 2.4. If it would, someone would already have set the
scope to compile. The following is the compile classpath of
maven-resources-plugin. It contains 'commons-io-2.5'. That version comes
from a test dependency. That can't be correct. That test dependency must
not be on the compile classpath, IMHO. I really think that is a bug.
Similar to <https://issues.apache.org/jira/browse/MNG-5988>. Aether does
not destinguish between different classpaths. The test classpath and the
main classpath really should be isolated / independent of each other.
The test dependencies may override dependencies from the compile
classpath during testing but not during compilation. The compile
classpath of maven-resources-plugin should contain commons-io-2.4
because it is a transitive dependency of a compile dependency and the
test classpath should contain commons-io-2.5.

[INFO] Changes detected - recompiling the module!
[DEBUG] Classpath:
[DEBUG]
/home/schulte/Sources/apache.org/plugins/maven-resources-plugin/target/classes
[DEBUG]
/home/schulte/.m2/repository/org/apache/maven/maven-plugin-api/3.0/maven-plugin-api-3.0.jar
[DEBUG]
/home/schulte/.m2/repository/org/sonatype/sisu/sisu-inject-plexus/1.4.2/sisu-inject-plexus-1.4.2.jar
[DEBUG]
/home/schulte/.m2/repository/org/sonatype/sisu/sisu-inject-bean/1.4.2/sisu-inject-bean-1.4.2.jar
[DEBUG]
/home/schulte/.m2/repository/org/sonatype/sisu/sisu-guice/2.1.7/sisu-guice-2.1.7-noaop.jar
[DEBUG]
/home/schulte/.m2/repository/org/apache/maven/maven-core/3.0/maven-core-3.0.jar
[DEBUG]
/home/schulte/.m2/repository/org/apache/maven/maven-settings-builder/3.0/maven-settings-builder-3.0.jar
[DEBUG]
/home/schulte/.m2/repository/org/apache/maven/maven-repository-metadata/3.0/maven-repository-metadata-3.0.jar
[DEBUG]
/home/schulte/.m2/repository/org/apache/maven/maven-model-builder/3.0/maven-model-builder-3.0.jar
[DEBUG]
/home/schulte/.m2/repository/org/sonatype/aether/aether-impl/1.7/aether-impl-1.7.jar
[DEBUG]
/home/schulte/.m2/repository/org/sonatype/aether/aether-spi/1.7/aether-spi-1.7.jar
[DEBUG]
/home/schulte/.m2/repository/org/sonatype/aether/aether-api/1.7/aether-api-1.7.jar
[DEBUG]
/home/schulte/.m2/repository/org/sonatype/aether/aether-util/1.7/aether-util-1.7.jar
[DEBUG]
/home/schulte/.m2/repository/org/codehaus/plexus/plexus-classworlds/2.2.3/plexus-classworlds-2.2.3.jar
[DEBUG]
/home/schulte/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.6/plexus-component-annotations-1.6.jar
[DEBUG]
/home/schulte/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[DEBUG]
/home/schulte/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[DEBUG]
/home/schulte/.m2/repository/org/apache/maven/maven-artifact/3.0/maven-artifact-3.0.jar
[DEBUG]
/home/schulte/.m2/repository/org/apache/maven/maven-settings/3.0/maven-settings-3.0.jar
[DEBUG]
/home/schulte/.m2/repository/org/apache/maven/maven-model/3.0/maven-model-3.0.jar
[DEBUG]
/home/schulte/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-annotations/3.4/maven-plugin-annotations-3.4.jar
[DEBUG]
/home/schulte/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.24/plexus-utils-3.0.24.jar
[DEBUG]
/home/schulte/.m2/repository/org/apache/maven/shared/maven-filtering/3.1.1/maven-filtering-3.1.1.jar
[DEBUG]
/home/schulte/.m2/repository/org/apache/maven/shared/maven-shared-utils/3.0.0/maven-shared-utils-3.0.0.jar
[DEBUG]
/home/schulte/.m2/repository/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar
[DEBUG]
/home/schulte/.m2/repository/org/sonatype/plexus/plexus-build-api/0.0.7/plexus-build-api-0.0.7.jar
[DEBUG]
/home/schulte/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar
[DEBUG]
/home/schulte/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.22/plexus-interpolation-1.22.jar
[DEBUG] Source roots:
[DEBUG]
/home/schulte/Sources/apache.org/plugins/maven-resources-plugin/src/main/java
[DEBUG]
/home/schulte/Sources/apache.org/plugins/maven-resources-plugin/target/generated-sources/plugin
[DEBUG]
/home/schulte/Sources/apache.org/plugins/maven-resources-plugin/target/generated-sources/annotations


Regards,
-- 
Christian


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Plugin resolution for Maven 3.5

Posted by Robert Scholte <rf...@apache.org>.
Hi,

there's this basic rule: always specify your direct dependencies if you  
use them in your code, never rely on transitive dependencies.
So in this case commons-io is not directly used by the main classes, but  
it is by the test-classes.
It is very likely that a previous version of maven-shared-utils did not  
depend on commons-io, which made it required to specify commons-io with  
the test-scope for this project.
With this in mind it seems weird to me to remove commons-io as a direct  
test-scoped dependency. If for some reason we don't need  
maven-shared-utils anymore the tests of this project won't build anymore.
What I would expect to see for the *runtime* plugin classpath are the  
direct dependencies with scopes compile, runtime and system, and all their  
transitive dependencies with the scopes compile, runtime and system.
The interesting thing that will happen here is that when testing it'll  
have commons-io:2.5 on its classpath, whereas at runtime it'll have  
commons-io:2.4 on its classpath. Based on the docs that can't be right  
(every dependency can only have one version and one scope) but I think it  
is.

thanks,
Robert

On Fri, 01 Jul 2016 09:16:47 +0200, Christian Schulte <cs...@schulte.it>  
wrote:

> Hi,
>
> I am currently stumbling upon the following issue. Maven resolves
> plugins as if they were a direct dependency of Maven core. That means it
> will not consider any 'test' or 'provided' scope dependencies of plugins
> when building plugin runtime classpaths. I am not sure if this is the
> correct way to go. If it would resolve plugins the same way it resolves
> projects, things like the following will start to happen.
>
> Execution default-resources of goal
> org.apache.maven.plugins:maven-resources-plugin:3.0.1:resources failed:
> A required class was missing while executing
> org.apache.maven.plugins:maven-resources-plugin:3.0.1:resources:
> org/apache/commons/io/input/XmlStreamReader
>
> Caused by: java.lang.ClassNotFoundException:
> org.apache.commons.io.input.XmlStreamReader
>
> Here is the plugin's classpath resolved by Maven <= 3.4.0-SNAPSHOT:
>
>  [DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=4,
> ConflictMarker.markTime=4, ConflictMarker.nodeCount=69,
> ConflictIdSorter.graphTime=2, ConflictIdSorter.topsortTime=1,
> ConflictIdSorter.conflictIdCount=28,
> ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=17,
> ConflictResolver.conflictItemCount=68,
> DefaultDependencyCollector.collectTime=850,
> DefaultDependencyCollector.transformTime=36}
> [DEBUG] org.apache.maven.plugins:maven-resources-plugin:jar:3.0.1:
> [DEBUG]    org.apache.maven:maven-plugin-api:jar:3.0:compile
> [DEBUG]       org.sonatype.sisu:sisu-inject-plexus:jar:1.4.2:compile
> [DEBUG]          org.sonatype.sisu:sisu-inject-bean:jar:1.4.2:compile
> [DEBUG]             org.sonatype.sisu:sisu-guice:jar:noaop:2.1.7:compile
> [DEBUG]    org.apache.maven:maven-core:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-settings-builder:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-repository-metadata:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-model-builder:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-aether-provider:jar:3.0:runtime
> [DEBUG]       org.sonatype.aether:aether-impl:jar:1.7:compile
> [DEBUG]          org.sonatype.aether:aether-spi:jar:1.7:compile
> [DEBUG]       org.sonatype.aether:aether-api:jar:1.7:compile
> [DEBUG]       org.sonatype.aether:aether-util:jar:1.7:compile
> [DEBUG]       org.codehaus.plexus:plexus-classworlds:jar:2.2.3:compile
> [DEBUG]
> org.codehaus.plexus:plexus-component-annotations:jar:1.6:compile
> [DEBUG]       org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3:compile
> [DEBUG]          org.sonatype.plexus:plexus-cipher:jar:1.4:compile
> [DEBUG]    org.apache.maven:maven-artifact:jar:3.0:compile
> [DEBUG]    org.apache.maven:maven-settings:jar:3.0:compile
> [DEBUG]    org.apache.maven:maven-model:jar:3.0:compile
> [DEBUG]    org.codehaus.plexus:plexus-utils:jar:3.0.24:compile
> [DEBUG]    org.apache.maven.shared:maven-filtering:jar:3.1.1:compile
> [DEBUG]        
> org.apache.maven.shared:maven-shared-utils:jar:3.0.0:compile
> [DEBUG]          commons-io:commons-io:jar:2.4:compile
> [DEBUG]          com.google.code.findbugs:jsr305:jar:2.0.1:compile
> [DEBUG]       org.sonatype.plexus:plexus-build-api:jar:0.0.7:compile
> [DEBUG]    org.codehaus.plexus:plexus-interpolation:jar:1.22:compile
>
> And here is the plugin's classpath resolved the same way projects are
> resolved (3.5.0-SNAPSHOT):
>
> [DEBUG] Dependency collection stats:
> {ConflictMarker.analyzeTime=3907145, ConflictMarker.markTime=5714366,
> ConflictMarker.nodeCount=172, ConflictIdSorter.graphTime=2411000,
> ConflictIdSorter.topsortTime=1248278,
> ConflictIdSorter.conflictIdCount=38,
> ConflictIdSorter.conflictIdCycleCount=0,
> ConflictResolver.totalTime=21802925,
> ConflictResolver.conflictItemCount=90,
> DefaultDependencyCollector.collectTime=1324192650,
> DefaultDependencyCollector.transformTime=190157370}
> [DEBUG] org.apache.maven.plugins:maven-resources-plugin:jar:3.0.1:
> [DEBUG]    org.apache.maven:maven-plugin-api:jar:3.0:compile
> [DEBUG]       org.sonatype.sisu:sisu-inject-plexus:jar:1.4.2:compile
> [DEBUG]          org.sonatype.sisu:sisu-inject-bean:jar:1.4.2:compile
> [DEBUG]             org.sonatype.sisu:sisu-guice:jar:noaop:2.1.7:compile
> [DEBUG]    org.apache.maven:maven-core:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-settings-builder:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-repository-metadata:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-model-builder:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-aether-provider:jar:3.0:runtime
> [DEBUG]       org.sonatype.aether:aether-impl:jar:1.7:compile
> [DEBUG]          org.sonatype.aether:aether-spi:jar:1.7:compile
> [DEBUG]       org.sonatype.aether:aether-api:jar:1.7:compile
> [DEBUG]       org.sonatype.aether:aether-util:jar:1.7:compile
> [DEBUG]       org.codehaus.plexus:plexus-classworlds:jar:2.2.3:compile
> [DEBUG]
> org.codehaus.plexus:plexus-component-annotations:jar:1.6:compile
> [DEBUG]       org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3:compile
> [DEBUG]          org.sonatype.plexus:plexus-cipher:jar:1.4:compile
> [DEBUG]    org.apache.maven:maven-artifact:jar:3.0:compile
> [DEBUG]    org.apache.maven:maven-settings:jar:3.0:compile
> [DEBUG]    org.apache.maven:maven-model:jar:3.0:compile
> [DEBUG]
> org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.4:provided
> [DEBUG]    org.codehaus.plexus:plexus-utils:jar:3.0.24:compile
> [DEBUG]    org.apache.maven.shared:maven-filtering:jar:3.1.1:compile
> [DEBUG]        
> org.apache.maven.shared:maven-shared-utils:jar:3.0.0:compile
> [DEBUG]          com.google.code.findbugs:jsr305:jar:2.0.1:compile
> [DEBUG]       org.sonatype.plexus:plexus-build-api:jar:0.0.7:compile
> [DEBUG]    org.codehaus.plexus:plexus-interpolation:jar:1.22:compile
> [DEBUG]    org.apache.maven:maven-compat:jar:3.0:test
> [DEBUG]        
> org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-6:test
> [DEBUG]
> org.apache.maven.plugin-testing:maven-plugin-testing-harness:jar:2.1:test
> [DEBUG]       org.codehaus.plexus:plexus-archiver:jar:2.2:test
> [DEBUG]
> org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:test
> [DEBUG]             classworlds:classworlds:jar:1.1-alpha-2:test
> [DEBUG]          org.codehaus.plexus:plexus-io:jar:2.0.4:test
> [DEBUG]    commons-io:commons-io:jar:2.5:test
> [DEBUG]    junit:junit:jar:4.12:test
> [DEBUG]       org.hamcrest:hamcrest-core:jar:1.3:test
>
> As you can see, the last classpath contains the direct 'test'
> dependencies of the plugin. I think that is correct, btw. The reason
> Maven will throw a ClassNotFoundException that way is the way the
> plugin's dependencies have been set up.
>
> The POM of the plugin contains 'commons-io:commons-io:jar:2.5:test'. If
> the 'test' scope dependencies are not considered during resolution (as
> it is), Maven will pull in 'commons-io:commons-io:jar:2.4:compile'
> because that is a transitive dependency of
> 'org.apache.maven.shared:maven-filtering:jar:3.1.1:compile'. Just
> compare the two classpath from where 'commons-io' is pulled in.
>
> Simple question we would need to discuss. Would you say the plugin's POM
> is incorrect because it contains that
> 'commons-io:commons-io:jar:2.5:test' dependency although that dependency
> really should be a 'compile' dependency? If it would not be a plugin but
> a library to depend on, we would all agree that the POM is incorrect. So
> I would say it is a bug because if you were to write a reusable "base"
> plugin to extend from (one of the reasons to use annotations), it would
> break the build for plugins depending on that "base" plugin.
>
> Regards,

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Plugin resolution for Maven 3.5

Posted by Anders Hammar <an...@hammar.net>.
Not sure I completely understand the question, but we've always said that
you shouldn't use another plugin as a dependency. Re-usable logic should be
kept in a library instead.

/Anders

On Fri, Jul 1, 2016 at 9:16 AM, Christian Schulte <cs...@schulte.it> wrote:

> Hi,
>
> I am currently stumbling upon the following issue. Maven resolves
> plugins as if they were a direct dependency of Maven core. That means it
> will not consider any 'test' or 'provided' scope dependencies of plugins
> when building plugin runtime classpaths. I am not sure if this is the
> correct way to go. If it would resolve plugins the same way it resolves
> projects, things like the following will start to happen.
>
> Execution default-resources of goal
> org.apache.maven.plugins:maven-resources-plugin:3.0.1:resources failed:
> A required class was missing while executing
> org.apache.maven.plugins:maven-resources-plugin:3.0.1:resources:
> org/apache/commons/io/input/XmlStreamReader
>
> Caused by: java.lang.ClassNotFoundException:
> org.apache.commons.io.input.XmlStreamReader
>
> Here is the plugin's classpath resolved by Maven <= 3.4.0-SNAPSHOT:
>
>  [DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=4,
> ConflictMarker.markTime=4, ConflictMarker.nodeCount=69,
> ConflictIdSorter.graphTime=2, ConflictIdSorter.topsortTime=1,
> ConflictIdSorter.conflictIdCount=28,
> ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=17,
> ConflictResolver.conflictItemCount=68,
> DefaultDependencyCollector.collectTime=850,
> DefaultDependencyCollector.transformTime=36}
> [DEBUG] org.apache.maven.plugins:maven-resources-plugin:jar:3.0.1:
> [DEBUG]    org.apache.maven:maven-plugin-api:jar:3.0:compile
> [DEBUG]       org.sonatype.sisu:sisu-inject-plexus:jar:1.4.2:compile
> [DEBUG]          org.sonatype.sisu:sisu-inject-bean:jar:1.4.2:compile
> [DEBUG]             org.sonatype.sisu:sisu-guice:jar:noaop:2.1.7:compile
> [DEBUG]    org.apache.maven:maven-core:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-settings-builder:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-repository-metadata:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-model-builder:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-aether-provider:jar:3.0:runtime
> [DEBUG]       org.sonatype.aether:aether-impl:jar:1.7:compile
> [DEBUG]          org.sonatype.aether:aether-spi:jar:1.7:compile
> [DEBUG]       org.sonatype.aether:aether-api:jar:1.7:compile
> [DEBUG]       org.sonatype.aether:aether-util:jar:1.7:compile
> [DEBUG]       org.codehaus.plexus:plexus-classworlds:jar:2.2.3:compile
> [DEBUG]
> org.codehaus.plexus:plexus-component-annotations:jar:1.6:compile
> [DEBUG]       org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3:compile
> [DEBUG]          org.sonatype.plexus:plexus-cipher:jar:1.4:compile
> [DEBUG]    org.apache.maven:maven-artifact:jar:3.0:compile
> [DEBUG]    org.apache.maven:maven-settings:jar:3.0:compile
> [DEBUG]    org.apache.maven:maven-model:jar:3.0:compile
> [DEBUG]    org.codehaus.plexus:plexus-utils:jar:3.0.24:compile
> [DEBUG]    org.apache.maven.shared:maven-filtering:jar:3.1.1:compile
> [DEBUG]       org.apache.maven.shared:maven-shared-utils:jar:3.0.0:compile
> [DEBUG]          commons-io:commons-io:jar:2.4:compile
> [DEBUG]          com.google.code.findbugs:jsr305:jar:2.0.1:compile
> [DEBUG]       org.sonatype.plexus:plexus-build-api:jar:0.0.7:compile
> [DEBUG]    org.codehaus.plexus:plexus-interpolation:jar:1.22:compile
>
> And here is the plugin's classpath resolved the same way projects are
> resolved (3.5.0-SNAPSHOT):
>
> [DEBUG] Dependency collection stats:
> {ConflictMarker.analyzeTime=3907145, ConflictMarker.markTime=5714366,
> ConflictMarker.nodeCount=172, ConflictIdSorter.graphTime=2411000,
> ConflictIdSorter.topsortTime=1248278,
> ConflictIdSorter.conflictIdCount=38,
> ConflictIdSorter.conflictIdCycleCount=0,
> ConflictResolver.totalTime=21802925,
> ConflictResolver.conflictItemCount=90,
> DefaultDependencyCollector.collectTime=1324192650,
> DefaultDependencyCollector.transformTime=190157370}
> [DEBUG] org.apache.maven.plugins:maven-resources-plugin:jar:3.0.1:
> [DEBUG]    org.apache.maven:maven-plugin-api:jar:3.0:compile
> [DEBUG]       org.sonatype.sisu:sisu-inject-plexus:jar:1.4.2:compile
> [DEBUG]          org.sonatype.sisu:sisu-inject-bean:jar:1.4.2:compile
> [DEBUG]             org.sonatype.sisu:sisu-guice:jar:noaop:2.1.7:compile
> [DEBUG]    org.apache.maven:maven-core:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-settings-builder:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-repository-metadata:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-model-builder:jar:3.0:compile
> [DEBUG]       org.apache.maven:maven-aether-provider:jar:3.0:runtime
> [DEBUG]       org.sonatype.aether:aether-impl:jar:1.7:compile
> [DEBUG]          org.sonatype.aether:aether-spi:jar:1.7:compile
> [DEBUG]       org.sonatype.aether:aether-api:jar:1.7:compile
> [DEBUG]       org.sonatype.aether:aether-util:jar:1.7:compile
> [DEBUG]       org.codehaus.plexus:plexus-classworlds:jar:2.2.3:compile
> [DEBUG]
> org.codehaus.plexus:plexus-component-annotations:jar:1.6:compile
> [DEBUG]       org.sonatype.plexus:plexus-sec-dispatcher:jar:1.3:compile
> [DEBUG]          org.sonatype.plexus:plexus-cipher:jar:1.4:compile
> [DEBUG]    org.apache.maven:maven-artifact:jar:3.0:compile
> [DEBUG]    org.apache.maven:maven-settings:jar:3.0:compile
> [DEBUG]    org.apache.maven:maven-model:jar:3.0:compile
> [DEBUG]
> org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.4:provided
> [DEBUG]    org.codehaus.plexus:plexus-utils:jar:3.0.24:compile
> [DEBUG]    org.apache.maven.shared:maven-filtering:jar:3.1.1:compile
> [DEBUG]       org.apache.maven.shared:maven-shared-utils:jar:3.0.0:compile
> [DEBUG]          com.google.code.findbugs:jsr305:jar:2.0.1:compile
> [DEBUG]       org.sonatype.plexus:plexus-build-api:jar:0.0.7:compile
> [DEBUG]    org.codehaus.plexus:plexus-interpolation:jar:1.22:compile
> [DEBUG]    org.apache.maven:maven-compat:jar:3.0:test
> [DEBUG]       org.apache.maven.wagon:wagon-provider-api:jar:1.0-beta-6:test
> [DEBUG]
> org.apache.maven.plugin-testing:maven-plugin-testing-harness:jar:2.1:test
> [DEBUG]       org.codehaus.plexus:plexus-archiver:jar:2.2:test
> [DEBUG]
> org.codehaus.plexus:plexus-container-default:jar:1.0-alpha-9-stable-1:test
> [DEBUG]             classworlds:classworlds:jar:1.1-alpha-2:test
> [DEBUG]          org.codehaus.plexus:plexus-io:jar:2.0.4:test
> [DEBUG]    commons-io:commons-io:jar:2.5:test
> [DEBUG]    junit:junit:jar:4.12:test
> [DEBUG]       org.hamcrest:hamcrest-core:jar:1.3:test
>
> As you can see, the last classpath contains the direct 'test'
> dependencies of the plugin. I think that is correct, btw. The reason
> Maven will throw a ClassNotFoundException that way is the way the
> plugin's dependencies have been set up.
>
> The POM of the plugin contains 'commons-io:commons-io:jar:2.5:test'. If
> the 'test' scope dependencies are not considered during resolution (as
> it is), Maven will pull in 'commons-io:commons-io:jar:2.4:compile'
> because that is a transitive dependency of
> 'org.apache.maven.shared:maven-filtering:jar:3.1.1:compile'. Just
> compare the two classpath from where 'commons-io' is pulled in.
>
> Simple question we would need to discuss. Would you say the plugin's POM
> is incorrect because it contains that
> 'commons-io:commons-io:jar:2.5:test' dependency although that dependency
> really should be a 'compile' dependency? If it would not be a plugin but
> a library to depend on, we would all agree that the POM is incorrect. So
> I would say it is a bug because if you were to write a reusable "base"
> plugin to extend from (one of the reasons to use annotations), it would
> break the build for plugins depending on that "base" plugin.
>
> Regards,
> --
> Christian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>