문제

In a pom.xml (jar packaging) i want to make use of the maven dependency plugin to download two kinds of dependencies. One kind i want to be downloaded with transitives and one without. Up to now, my plugins section contains follwing element:

<plugin>
  <artifactId>maven-dependency-plugin</artifactId>
  <version>2.5</version>
  <executions>
    <execution>
  <id>Copy dependencies transitive</id>
  <phase>initialize</phase>
  <goals>
    <goal>copy-dependencies</goal>
  </goals>
      <configuration>
        <excludeTransitive>false</excludeTransitive>
    <outputDirectory>lib</outputDirectory>
        <includeArtifactIds>artifact_1</includeArtifactIds>
  </configuration>
</execution>

    <execution>
      <id>Copy dependencies not transitive</id>
  <phase>initialize</phase>
  <goals>
    <goal>copy-dependencies</goal>
  </goals>
  <configuration>
        <outputDirectory>samples</outputDirectory>
        <excludeTransitive>true</excludeTransitive>
        <includeArtifactIds>artifact_2,artifact_3</includeArtifactIds>
  </configuration>
</execution>
  </executions>
</plugin>

after doing

mvn initialize

artifact_1 is located in lib and artifact_2 and 3 are located in samples. However artifacts_1's transitive dependencies cannot be found. Is this a right way to go? I somehow expect this solution to work already, but as it seems it does not... Corrections would be welcome...

도움이 되었습니까?

해결책

Just found whats going on...
includeArtifactIds affects also the transitive dependencies. So if artifact_4 and artifact_5 are transitive dependencies of artifact_1 they are just not copied because i did not include them. I consider this a little unexpected, but well... thats how it was implemented (but not documented). Now i just changed from includeArtifacts to excludeArtifacts and it works.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top