对于我的tycho反应器中的一个插件,我想在名为“ lib /”的文件夹中复制“纯maven”依赖项及其可传递的依赖项。
当前,如果我使用copy-dependencies
中的maven-dependency-plugin
目标,则可以正确复制我的依存关系,但也可以复制tycho解决的“插件依存关系”,而我则不需要。
有没有实现这一目标的建议?我目前正在使用以下代码段
<dependencies>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>${maven.groupid}</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>process-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
欢迎提出任何建议。
答案 0 :(得分:0)
在this discussion on Eclipse forums之后,似乎我们可以告诉Maven仅使用pom.xml
和excludeScope
标记的组合来包含来自当前includeScope
文件的依赖项。
此更新的XML代码段按预期完成了工作
<dependencies>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>${maven.groupid}</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>process-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
<!-- The lines below are aimed at telling maven NOT TO COPY tycho dependencies. Do not remove those! -->
<!-- See: https://dev.eclipse.org/mhonarc/lists/tycho-user/msg05080.html -->
<excludeScope>system</excludeScope>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>