如何忽略 maven-dependency-plugin 复制目标错误?

发布于 2025-01-01 15:11:55 字数 1368 浏览 3 评论 0原文

在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

£烟消云散 2025-01-08 15:11:55

我猜您遇到了解决问题,即该工件不存在或无法在任何存储库中找到。这就是 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.

佼人 2025-01-08 15:11:55

我现在通过使用jenkins的复制神器插件解决了我的问题。

I resolved my problem by using the copy artifact plugin of jenkins now.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文