On 11/09/2010 06:43 PM, Benjamin Bentmann wrote:
Not possible.

Thanks, at least I will not waste more time trying.

usually accomplished by an artifact
handler for the dependency type in question which sets
includesDependencies=true like for WAR artifacts.

Interesting, did not think to look there. (Typically, there is no Javadoc on 
ArtifactHandler explaining what it does.) In my case this is already set to 
true:

    <component>
      <role>org.apache.maven.artifact.handler.ArtifactHandler</role>
      <role-hint>nbm</role-hint>
      
<implementation>org.apache.maven.artifact.handler.DefaultArtifactHandler</implementation>
      <configuration>
        <type>nbm</type>
        <extension>jar</extension>
        <packaging>nbm</packaging>
        <addedToClasspath>true</addedToClasspath>
        <language>java</language>
        <includesDependencies>true</includesDependencies>
      </configuration>
    </component>

yet dependencies on this kind of artifact are still resolved transitively. (There is also a handler for extension nbm, which a separate mojo uses via attachArtifact, but these artifacts are not added to the classpath.)

Really I would prefer to override the ProjectDependenciesResolver in the _depending_ project (with packaging nbm), so that it does not traverse the graph for dependencies of type nbm in compile scope; it is fine for dependencies on nbm-packaged JARs to be transitive when used from a jar-packaging project. Dependencies of type jar should be transitive, and test-scope dependencies must be transitive even when of type nbm (*).

(*) Since Maven fails to properly distinguish between test compile and test runtime scope and this is only possible via hacky configuration in the Surefire plugin. Ideally tests would compile against compile & test scopes, and run against compile & runtime & test & test-runtime scopes. Including full transitive dependencies in the test compile classpath might seem harmless enough, but it can apparently make compilation vastly slower on Windows when the dependency graph is big.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to