use*_*197 8 dependencies maven
我有2个工件,我想从我的本地存储库复制到文件系统中的目录.
我认为依赖:复制做这个工作.但是,它需要一个参数artifactItems. http://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-artifacts.html
任何人都可以帮助我在命令行中使用此目标.不幸的是,maven并没有在命令行中显示这个目标的用法.
与其试图弄清楚如何提供artifactItemby 命令行,不如为依赖项插件配置命令行执行。通过指定default-cli为执行 ID来执行此操作。如果您总是想复制相同的依赖项,您可以在工件项目中硬编码 GAV 坐标。或者,硬编码在命令之间保持不变的任何值。
要通过命令行复制不同的工件,请将属性用作元素值并在命令行上指定值。例如,如果artifactItem包含的配置<artifactId>${copy.artifactId}</artifactId>则
mvn dependency:copy -Dcopy.artifactId=myArtifact
将复制 myArtifact(示例假设其他元素具有硬编码值)。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>default-cli</id>
<configuration>
<artifactItems>
<artifactItem>
<!-- hardcode values, or use properties, depending on what you want to do -->
<groupId>[ groupId ]</groupId>
<artifactId>[ artifactId ]</artifactId>
<version>[ version ]</version>
<type>[ packaging ]</type>
<outputDirectory>/the/filesystem/dir</outputDirectory>
</artifactItem>
</artifactItems>
<!-- other configurations here -->
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8259 次 |
| 最近记录: |