Jenkins 构建失败

构建步骤“调用顶级 Maven 目标”将构建标记为失败

我是 Jenkins 的新手,不确定为什么构建失败。
请看日志:

[INFO] yarn install v0.27.5 
[INFO] [1/4] Resolving packages... 
[INFO] [2/4] Fetching packages... 
[WARNING] warning fsevents@1.1.1: The platform "linux" is incompatible with this module. 
[INFO] info "fsevents@1.1.1" is an optional dependency and failed compatibility check. Excluding it from installation. 
[INFO] [3/4] Linking dependencies... 
[INFO] [4/4] Building fresh packages... 
Build step 'Invoke top-level Maven targets' marked build as failure 
Finished: FAILURE 

我的 pom.xml 有以下配置:
<properties> 
        <project.frontend.nodeVersion>v6.10.0</project.frontend.nodeVersion> 
        <project.frontend.yarnVersion>v0.27.5</project.frontend.yarnVersion> 
        <skipGulp>false</skipGulp> 
        <build.args>publish:dev:all</build.args> 
    </properties> 
 
    <build> 
        <plugins> 
            <plugin> 
                <groupId>com.github.eirslett</groupId> 
                <artifactId>frontend-maven-plugin</artifactId> 
                <version>1.3</version> 
                <configuration> 
                    <skip>${skipGulp}</skip> 
                </configuration> 
                <executions> 
                    <execution> 
                        <id>install node and yarn</id> 
                        <goals> 
                            <goal>install-node-and-yarn</goal> 
                        </goals> 
                        <configuration> 
                            <nodeVersion>${project.frontend.nodeVersion}</nodeVersion> 
                            <yarnVersion>${project.frontend.yarnVersion}</yarnVersion> 
                        </configuration> 
                    </execution> 
                    <execution> 
                        <id>yarn install</id> 
                        <goals> 
                            <goal>yarn</goal> 
                        </goals> 
            <configuration> 
              <failOnError>false</failOnError> 
            </configuration> 
                    </execution> 
          <execution> 
            <id>fix node-sass package</id> 
            <goals> 
              <goal>npm</goal> 
            </goals> 
            <configuration> 
              <arguments>rebuild node-sass</arguments> 
            </configuration> 
          </execution> 
                    <execution> 
                        <id>yarn</id> 
                        <goals> 
                            <goal>yarn</goal> 
                        </goals> 
                        <configuration> 
                            <arguments>run ${build.args}</arguments> 
                        </configuration> 
                    </execution> 
                </executions> 
            </plugin> 
        </plugins> 
    </build> 

我真的很感激这方面的任何帮助。
谢谢。

请您参考如下方法:

Jenkins中的一些maven版本似乎有问题,
另一个合适的解决方案是在 Jenkins 上添加另一个 maven 安装。

  • 从 Jenkins 的起始页转到:管理 Jenkins > 全局工具
    配置,并查找向下滚动的 Maven 部分。
  • 按下按钮“Maven 安装”并配置一个新的 Maven
    安装。
    see the image "Maven installation button"
  • 在名为“名称”的文本框中键入要标识的名称
    那个新安装。例如。 “Apache Maven 3.3.9”。
  • 选中“自动安装”选项。
  • 在选择菜单中选择版本 3.3.9。
    see the image "New maven installation"
  • 下面点击保存按钮。
  • 转到 Jenkins 主页并输入您要构建的作业。
  • 在左侧,单击“配置”选项。
  • 然后在 Build Section 中选择您已经设置的新 maven 安装的名称。 see image "set the new maven installation"
  • 点击保存并重新构建您的工作。

  • 如果您看到构建 #? 的输出控制台,Jenkins 将下载新的 maven 版本并将其安装在您的机器上并执行构建。

    如果一切正常,您应该看到:[INFO] BUILD SUCCESS...

    这将帮助您了解该版本的 Maven 是否正常工作。然后你可以在你的系统上安装第二个 maven 版本。

    Once you have it installed the other maven version on your machine, re-config it on:
    Manage Jenkins > Global Tool Configuration and set the path of the maven source (src) folder, but this time uncheck the "install automatically option" see image "Set maven path installation" now you can build all your jobs in Jenkins.



    最后重复步骤“7、8 和 9”将您的新配置设置为默认值!

    祝你好运!


    评论关闭
    IT干货网

    微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!