我有两个工件要从本地存储库复制到文件系统中的一个目录中。
我认为依赖:复制可以做到这一点。但是,它需要一个参数artifactItems。http://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-artifacts.html
有人能帮助我在命令行中使用这个目标吗?不幸的是,maven没有在命令行中显示这个目标的用法。
发布于 2012-06-26 23:32:55
我不会试图弄清楚如何通过命令行提供artifactItem
,而是为依赖插件配置命令行执行。通过指定default-cli
作为执行ID,如果你总是想复制相同的依赖项,你可以在工件项中硬编码GAV coord。或者,对命令之间保持不变的任何值进行硬编码。
要通过命令行复制不同的工件,请使用属性作为元素值,并在命令行上指定值。例如,如果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>
https://stackoverflow.com/questions/11205669
复制相似问题