jav*_*csw 8 configuration maven-2 maven-dependency-plugin
我有以下配置:
<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>
Run Code Online (Sandbox Code Playgroud)
上面的配置会转储同一文件夹中的所有内容.我尝试通过添加测试配置来排除测试范围但是给出了错误:
未能执行目标org.apache.maven.plugins:Maven的依赖关系的插件:2.6:项目pcgen复制依赖(复制依赖):不能排除测试范围,这将排除一切.
有没有办法将测试依赖项与其他依赖项分开,以便我可以复制到不同的文件夹?
我尝试通过添加测试配置来排除测试范围但是给出了错误
我偶然发现了这个,可能是出于不同的原因,但我想我找到了答案.例如,尝试这样做.当然,您需要在当前目录中使用pom.xml.
mvn dependency:copy-dependencies \
-DincludeScope=runtime \
-DexcludeScope=provided \
-DoutputDirectory=target/war/WEB-INF/lib
Run Code Online (Sandbox Code Playgroud)
感谢Brian Fox,感谢Maven Dependency Plugin Issue#128:
您不应该同时包含或排除两个范围,因为它们是由彼此组成的.默认设置是包含测试范围,其中包括所有内容.如果您不想要任何测试依赖项或提供的依赖项,那么请包含runtime和exclude.
正在解释的范围是maven看到的范围,而不是pom中指定的范围.所以"测试"范围包括一切,运行时包括编译但未提供等.
2013年5月,includeScope文档更新为:
/**
* 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;
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1047 次 |
最近记录: |