Java Maven 无法在 jenkins 解析 POM

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22449689/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 15:46:56  来源:igfitidea点击:

Maven fails to parse POMs at jenkins

javamavenjenkins

提问by Lasse L

I have this simple maven project, containing a few common test tools. It builds locally, but on jenkins I am getting this strange error (see below).

我有这个简单的 maven 项目,包含一些常用的测试工具。它在本地构建,但在 jenkins 上我收到了这个奇怪的错误(见下文)。

Other info:

其他信息:

  • It builds locally with maven
  • Settings are the same as all our other jenkins projects (very basic)
  • Other jenkins builds work just fine
  • I tried removing the /root/.jenkins/workspace/testtools folder
  • I tried deleting the build and giving it a new name
  • The disk is not full
  • I failed to find any useful infomation elsewhere regarding this specific problem.
  • 它使用 maven 在本地构建
  • 设置与我们所有其他 jenkins 项目相同(非常基本)
  • 其他 jenkins 构建工作得很好
  • 我尝试删除 /root/.jenkins/workspace/testtools 文件夹
  • 我尝试删除构建并给它一个新名称
  • 磁盘未满
  • 我未能在其他地方找到有关此特定问题的任何有用信息。

**

**

Parsing POMs
ERROR: Failed to parse POMs
hudson.maven.MavenEmbedderException: 1 problem was encountered while building the effective settings
[FATAL] Non-readable settings /root/.jenkins/workspace/testtools: /root/.jenkins/workspace/testtools (Is a directory) @ /root/.jenkins/workspace/testtools**
at hudson.maven.MavenEmbedder.<init>(MavenEmbedder.java:128)
at hudson.maven.MavenEmbedder.<init>(MavenEmbedder.java:109)
at hudson.maven.MavenEmbedder.<init>(MavenEmbedder.java:136)
at hudson.maven.MavenUtil.createEmbedder(MavenUtil.java:212)
at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1254)
at hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1058)
at hudson.FilePath.act(FilePath.java:909)
at hudson.FilePath.act(FilePath.java:882)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.parsePoms(MavenModuleSetBuild.java:920)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:652)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:586)
at hudson.model.Run.execute(Run.java:1603)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:506)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:247)
Caused by: hudson.maven.MavenEmbedderException: 1 problem was encountered while building the effective settings
[FATAL] Non-readable settings /root/.jenkins/workspace/testtools: /root/.jenkins/workspace/testtools (Is a directory) @ /root/.jenkins/workspace/testtools
at hudson.maven.MavenEmbedder.getSettings(MavenEmbedder.java:261)
at hudson.maven.MavenEmbedder.buildMavenExecutionRequest(MavenEmbedder.java:157)
at hudson.maven.MavenEmbedder.<init>(MavenEmbedder.java:120)
... 14 more
Caused by: org.apache.maven.settings.building.SettingsBuildingException: 1 problem was    encountered while building the effective settings
[FATAL] Non-readable settings /root/.jenkins/workspace/testtools: /root/.jenkins/workspace/testtools (Is a directory) @ /root/.jenkins/workspace/testtools
at org.apache.maven.settings.building.DefaultSettingsBuilder.build(DefaultSettingsBuilder.java:116)
at hudson.maven.MavenEmbedder.getSettings(MavenEmbedder.java:259)
... 16 more
Finished: FAILURE

采纳答案by blackbuild

Maven tries to read /root/.jenkins/workspace/testtoolsas its user settings file (normally under /root/.m2/settings.xml). Since this is a directory, it can't be read.

Maven 尝试读取/root/.jenkins/workspace/testtools其用户设置文件(通常在 下/root/.m2/settings.xml)。由于这是一个目录,因此无法读取。

Check in your Job configuration under Build -> Advanced... -> settings fileYou seem to have selected Settings in file systemwithout any value. Change this to "Use default maven setting" and you are good.

Build -> Advanced... -> settings file您似乎没有选择Settings in file system任何值下检查您的作业配置。将其更改为“使用默认 Maven 设置”,您就可以了。

回答by MarianP

I had the problem after I changed the build name and it included a space character. the 'execute shell' was using $WORKSPACE variable and that didn't work because of the space.

更改构建名称后我遇到了问题,它包含一个空格字符。'execute shell' 正在使用 $WORKSPACE 变量,由于空间的原因,它不起作用。

回答by MarianP

This error could be triggered if the fully qualified path name for pom.xml is not used in the project configuration e.g C:\Users\user1\workspace\WebdriverTestis a not fully qualified. This is one is: C:\Users\user1\workspace\WebdriverTest\pom.xmlTake note of the \pom.xml

如果项目配置中未使用 pom.xml 的完全限定路径名,例如C:\Users\user1\workspace\WebdriverTest不是完全限定的,则可能会触发此错误 。这是其中之一:C:\Users\user1\workspace\WebdriverTest\pom.xml注意\pom.xml

回答by dan

We had this problem which was caused by a bugin the Jenkins Maven Plugin. Updating to a version above 2.15.1 solved it for us.

我们遇到了这个问题,这是由Jenkins Maven 插件中的一个错误引起的。更新到 2.15.1 以上的版本为我们解决了这个问题。

回答by Utsav Patel

enter image description here

enter image description here

Check in your Project configuration in Jenkins under

在 Jenkins 下检查您的项目配置

Build -> Advanced... -> settings 

here make everything default and you good to go

在这里让一切都默认,你很高兴去