如何忽略 maven-dependency-plugin 复制目标错误?
在使用 maven-dependecy-plugins 复制目标打包之前,我将资源复制到另一个文件夹中。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>copy</id>
<phase>prepare-package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<failBuild>false</failBuild>
<artifactItems>
<artifactItem>
<groupId>my.groupID</groupId>
<artifactId>myArtifact</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>my/custom/path</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
该资源并不重要,并且很可能无法访问。这就是为什么我希望构建在不可访问的情况下不会失败。我已经将 failedBuild 属性设置为 false 但没有任何效果。有办法实现这一点吗?
I am copying a resource into another folder before packaging using the maven-dependecy-plugins copy goal.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>copy</id>
<phase>prepare-package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<failBuild>false</failBuild>
<artifactItems>
<artifactItem>
<groupId>my.groupID</groupId>
<artifactId>myArtifact</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>my/custom/path</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
The resource is not vital and it is likely possible that it is not accessible. That's why I want the build not to fail if it is not accessible. I already set the failBuild property to false but it had no effect. Is there a way to achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我猜您遇到了解决问题,即该工件不存在或无法在任何存储库中找到。这就是 Maven 的工作原理,如果您指定一个依赖项,您需要能够检索它。
I guess you get a resolve problem, that the artifact doesnt exist or can't be found in any repository. That's how maven works, if you specify a dependency you need to be able to retrieve it.
我现在通过使用jenkins的复制神器插件解决了我的问题。
I resolved my problem by using the copy artifact plugin of jenkins now.