gpt4 book ai didi

configuration - 有没有办法在复制依赖目标期间使用 maven-dependency-plugin 在测试和编译之间划分工件?

转载 作者:行者123 更新时间:2023-12-04 07:40:44 26 4
gpt4 key购买 nike

我有以下配置:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>analyze</id>
<goals>
<goal>analyze-only</goal>
</goals>
<configuration>
<failOnWarning>false</failOnWarning>
</configuration>
</execution>
<!--Copy the dependencies so ant build has the same versions-->
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/lib</outputDirectory>
<overWriteIfNewer>true</overWriteIfNewer>
<stripVersion>true</stripVersion>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<excludeTransitive>false</excludeTransitive>
</configuration>
</execution>
</executions>
</plugin>

上述配置将所有内容转储到同一文件夹中。我尝试通过添加测试配置来排除测试范围,但出现错误:

Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.6:copy-dependencies (copy-dependencies) on project pcgen: Can't exclude Test scope, this will exclude everything.



有没有办法将测试依赖项与其他依赖项分开,以便我可以复制到不同的文件夹?

最佳答案

I tried excluding the test scope by adding the test configuration but gives an error


我只是偶然发现了这个,可能是出于非常不同的原因,但我想我找到了我们两个的答案。例如,试试这个。当然,您将需要当前目录中的 pom.xml。
mvn dependency:copy-dependencies \
-DincludeScope=runtime \
-DexcludeScope=provided \
-DoutputDirectory=target/war/WEB-INF/lib
非常迟来的感谢 Brian Fox,他在 Maven Dependency Plugin Issue #128 上写道:

You shouldn't ever need to include or exclude two scopes at the same time because they are comprised of each other. The default is to include test scope, which includes everything. If you don't want any test dependencies or provided dependencies, then include runtime and exclude provided.

The scopes being interpreted are the scopes as maven sees them, not as specified in the pom. So the "test" scope includes everything, runtime includes compile but not provided etc.


2013年5月, includeScope documentation was updated到:
/**
* Scope to include. An Empty string indicates all scopes (default).
* The scopes being interpreted are the scopes as
* Maven sees them, not as specified in the pom. In summary:
* <ul>
* <li><code>runtime</code> scope gives runtime and compile dependencies,</li>
* <li><code>compile</code> scope gives compile, provided, and system dependencies,</li>
* <li><code>test</code> (default) scope gives all dependencies,</li>
* <li><code>provided</code> scope just gives provided dependencies,</li>
* <li><code>system</code> scope just gives system dependencies.</li>
* </ul>
*
* @since 2.0
*/
@Parameter( property = "includeScope", defaultValue = "" )
protected String includeScope;

关于configuration - 有没有办法在复制依赖目标期间使用 maven-dependency-plugin 在测试和编译之间划分工件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13727165/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com