在 pom.xml(jar 包装)中,我想利用 maven 依赖插件下载两种依赖项。我想下载一种带及物的,一种不带。到目前为止,我的插件部分包含以下元素:
<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>
做完之后
mvn initialize
artifact_1 位于 lib 中,artifact_2 和 3 位于 samples 中。但是,artifacts_1 的传递依赖项找不到。这是正确的方法吗?我以某种方式希望这个解决方案已经可以工作,但它似乎没有......欢迎更正......