Pis*_*ete 7 maven-3 maven-dependency-plugin
我正在尝试从依赖jar文件中提取一些.exe文件,并将它们放在$ {project.build.directory}/classes /下.
但是当我执行时:
mvn clean编译依赖:unpack
我得到:
无法执行目标org.apache.maven.plugins:maven-dependency-plugin:2.10:unpack(default-cli)项目简单:需要artifact或artifactItems - > [帮助1
我已经验证了依赖项在我的本地存储库中可用.
在我的示例pom中,我使用junit作为示例,但无论我列出哪个依赖项,我都会得到相同的错误.
pom.xml中:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>unpack</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<type>jar</type>
<overWrite>false</overWrite>
<outputDirectory>${project.build.directory}/classes/externaltools</outputDirectory>
<includes>**/*.txt</includes>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
Run Code Online (Sandbox Code Playgroud)
Kin*_*das 10
问题是由于您无法一起使用mvn clean compile dependency:unpack和<executions>标记.
在页面底部的文档Maven Depdendency Plugin中,您可以阅读:
如果您打算使用以下命令在命令行上配置此mojo以执行:
mvn dependency:unpack您不得将配置放在executions标记内.您的配置应如下所示:
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<configuration>
<artifactItems>
<artifactItem>
<groupId>[ groupId ]</groupId>
<artifactId>[ artifactId ]</artifactId>
<version>[ version ]</version>
<type>[ packaging ]</type>
<classifier> [classifier - optional] </classifier>
<overWrite>[ true or false ]</overWrite>
<outputDirectory>[ output directory ]</outputDirectory>
<destFileName>[ filename ]</destFileName>
<includes>[ comma separated list of file filters ]</includes>
<excludes>[ comma separated list of file filters ]</excludes>
</artifactItem>
</artifactItems>
<!-- other configurations here -->
</configuration>
</plugin>
</plugins>
</build>
[...]
</project>
Run Code Online (Sandbox Code Playgroud)
我试过删除<execution>标签,并完美地工作!
| 归档时间: |
|
| 查看次数: |
11196 次 |
| 最近记录: |