Maven Multi Module project fails on Jenkins Pipeline as the agent is not of the same os as being enforced by maven-enforcer-plugin

huangapple 未分类评论43阅读模式
英文:

Maven Multi Module project fails on Jenkins Pipeline as the agent is not of the same os as being enforced by maven-enforcer-plugin

问题

我有一个用Java编写并使用swt的多模块Maven项目。我有一个Jenkins实例,上面有两个节点。一个基于Windows,另一个基于Linux。两者都有标签。在我的Jenkinsfile中,我已将代理指定为'any'。我的多模块Maven项目中的一些项目正在使用maven-enforcer-plugin来强制将操作系统设置为Windows。当构建开始时,Jenkins会选择基于Linux的节点,然后我的构建将因以下错误而失败。

[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireOS 未通过,错误消息如下:
操作系统架构:amd64 家族:unix 名称:linux 版本:3.10.0-862.14.4.el7.x86_64 不允许使用Family=windows
...
[ERROR] 无法执行目标 org.apache.maven.plugins:maven-enforcer-plugin:1.3.1:enforce(enforce-execution-environment),位于项目:某些Enforcer规则未通过。请查看上方的特定消息,了解规则未通过的原因。

我该如何解决这个问题?有什么想法吗?如果这是一个重复的问题,请随时关闭它并指向先前的问题。

英文:

I have a multi module maven project made in Java and utilizing swt. I have a Jenkins instance where I have two slaves. One is windows based and other is linux based. Both have labels on them. In my Jenkinsfile I have specified the agent as 'any'. A few project in my multi module maven project are using maven-enforcer-plugin to enforce the os as windows. When my build starts Jenkins will pick up the linux based slave and my build will fail with the following error(s).

[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequireOS failed with message:
OS Arch: amd64 Family: unix Name: linux Version: 3.10.0-862.14.4.el7.x86_64 is not allowed by Family=windows
...
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.3.1:enforce (enforce-execution-environment) on project <xyz-project-using-swt>: Some Enforcer rules have failed. Look above for specific messages explaining why the rule failed.

How do I resolve this? Any ideas? If this is a repeated question feel free to close it and point to the previous question.

huangapple
  • 本文由 发表于 2020年4月4日 06:18:34
  • 转载请务必保留本文链接:https://java.coder-hub.com/61021259.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定