Tycho copy-dependencies 不包括插件依赖

Tycho copy-dependencies do not include plugin dependencies

对于我第谷反应器中的一个插件,我想复制一个 "pure-maven" 依赖项及其传递性依赖项到名为 "lib/".

的文件夹中

目前,如果我使用 maven-dependency-plugin 中的 copy-dependencies 目标,我的依赖关系会被正确复制,但 tycho 解析的 "plugin-dependencies" 也会被复制,我不想要那些。

有什么建议可以实现这个目标吗?我目前正在使用以下代码片段

<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>

欢迎提出任何建议。

this discussion on Eclipse forums 之后,我们似乎可以使用 excludeScopeincludeScope 标记的组合告诉 Maven 仅包含来自当前 pom.xml 文件的依赖项。

这个更新的 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>