首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >由于jenkins中的局部修改,Maven发布插件中止准备就绪

由于jenkins中的局部修改,Maven发布插件中止准备就绪
EN

Stack Overflow用户
提问于 2016-09-09 08:51:25
回答 2查看 8.7K关注 0票数 2

问题:

当我执行maven发布插件的准备目标时,就会得到错误。

错误未能在项目my-工件-id:无法准备发行版上执行目标org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (默认-cli),因为您有本地修改: 错误 ..。 错误

大约20份文件。

详细信息

  • 发布插件是从Jenkins执行的。
  • SVN被配置为“始终签出一个新副本”。
  • Maven发布插件与目标-Dresume=false clean release:prepare release:perform一起使用。
  • 修改后的文件在最后一次提交中被修改。
  • 此错误发生在执行准备目标: INFO --maven-release:2.3.2:准备(默认-cli)@工件-id时。
  • 在过去的11次中,这个发布插件运行得非常成功(但有时它在第一次尝试中不起作用,但在第二次尝试中却不起作用)

相似问题

为什么其他问题没有帮助:

日志

我试图匿名,所以你发现有些部分被替换的意思所取代。

代码语言:javascript
复制
Started by user Sergej Werfel
[EnvInject] - Loading node environment variables.
Building remotely on Build in workspace E:\Jenkins\Build\workspace\project-dir
Cleaning local Directory .
Checking out [svn-url] at revision '2016-09-09T10:12:55.444 +0200'
...
A         some file
...
AU        some other file
AU        pom.xml
AU        event more files
...
 U        .
At revision 1639745
no change for [svn-url] since the previous build
Injecting SonarQube environment variables using the configuration: Sonar 5
Parsing POMs
Injecting SonarQube environment variables using the configuration: Sonar 5
using global settings config with name MVN Settings [setting name]
Replacing all maven server entries not found in credentials list is true
Injecting SonarQube environment variables using the configuration: Sonar 5
Injecting SonarQube environment variables using the configuration: Sonar 5
Injecting SonarQube environment variables using the configuration: Sonar 5
Injecting SonarQube environment variables using the configuration: Sonar 5
Injecting SonarQube environment variables using the configuration: Sonar 5
Injecting SonarQube environment variables using the configuration: Sonar 5
Injecting SonarQube environment variables using the configuration: Sonar 5
Established TCP socket on 18423
maven32-agent.jar already up to date
maven32-interceptor.jar already up to date
maven3-interceptor-commons.jar already up to date
[project name] $ "C:\Program Files\Java\jdk1.8.0_51/bin/java" -cp E:\Jenkins\Build\maven32-agent.jar;C:\apache-maven-3.3.9\boot\plexus-classworlds-2.5.2.jar;C:\apache-maven-3.3.9/conf/logging jenkins.maven3.agent.Maven32Main C:\apache-maven-3.3.9 E:\Jenkins\Build\slave.jar E:\Jenkins\Build\maven32-interceptor.jar E:\Jenkins\Build\maven3-interceptor-commons.jar 18423
<===[JENKINS REMOTING CAPACITY]===>channel started
using global settings config with name MVN Settings [setting name]
Replacing all maven server entries not found in credentials list is true
Executing Maven:  -B -f [path to root pom]\pom.xml -gs [path to settings]\global-settings1467677761792043752.xml -DdevelopmentVersion=0.1.13-SNAPSHOT -DreleaseVersion=0.1.12 -Dresume=false -DdryRun=true clean release:prepare
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] [project name]
[INFO] module-1
[INFO] module-2
[INFO] module-3
[INFO] module-4
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building root project name 0.1.12-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ root-project ---
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building module-1 0.1.12-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ module-1 ---
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building module-2 0.1.12-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ module-2 ---
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building module-3 0.1.12-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ module-3 ---
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building module-4 0.1.12-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ module-4 ---
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building project name 0.1.12-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-release-plugin:2.3.2:prepare (default-cli) @ root-project ---
[INFO] Verifying that there are no local modifications...
[INFO]   ignoring changes on: **\pom.xml.next, **\release.properties, **\pom.xml.branch, **\pom.xml.tag, **\pom.xml.backup, **\pom.xml.releaseBackup
[INFO] Executing: cmd.exe /X /C "svn --non-interactive status"
[INFO] Working directory: E:\Jenkins\Build\workspace\project-dir
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] root-project ................................ FAILURE [  1.016 s]
[INFO] module-1 .......................... SUCCESS [  0.047 s]
[INFO] module-2 ............................ SUCCESS [  0.049 s]
[INFO] module-3 ....................... SUCCESS [  0.084 s]
[INFO] module-4 ........................ SUCCESS [  0.068 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.089 s
[INFO] Finished at: 2016-09-09T10:13:08+02:00
[INFO] Final Memory: 15M/234M
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.3.2:prepare (default-cli) on project root-project: Cannot prepare the release because you have local modifications :
[ERROR] [module-1\src\test\java\package\SomeJavaTest.java:modified]
[ERROR] [... some other files ...]
[ERROR] [module-2\src\main\java\package\SomeJavaFile.java:modified]
[ERROR] [... some other files ...]
[ERROR] [module-2\src\test\java\package\AnOtherTestTest.java:modified]
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[JENKINS] Archiving E:\Jenkins\Build\workspace\project-dir\module-1\pom.xml to [some path]/0.1.12-SNAPSHOT/module-1-0.1.12-SNAPSHOT.pom
[other modules]
[M2Release] its only a dryRun, no need to mark it for keep
channel stopped
Warning: you have no plugins providing access control for builds, so falling back to legacy behavior of permitting any downstream builds to be triggered
Finished: FAILURE

项目结构

代码语言:javascript
复制
- root-dir
|- module-1-dir
|'- module-1-pom
|- module-2-dir
|'- module-1-pom
| ...
'-root-pom
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-09-16 08:55:30

概述

提交的文件只有\n( = lf = line feed)作为以subversion结尾的行。他们是在windows机器上签出的,所以结尾变成了\r\n(= crlf = carriage return and line feed)。因此,文件在被发现为“修改”之前已经更改。使用\r\n-ending直接修复该文件中的签入。

查找的方法

  • 在对Jenkins进行了新的检查之后,您可以以skript的形式运行"svn状态“,即文件被标记为”修改“。
  • 当您调用"svn“时,您将看到每个文件在每一行中都不同,但是您没有看到差异=>不可见的更改。
  • 从jenkins工作区打开一个这样的修改文件,从svn打开一个这样的文件,并使用一个编辑器查看它们,该编辑器可以可视化不可见的字符(例如,Notepad++带有工具栏中的“显示所有字符”)

原因

发生这种情况的原因是git-svn的错误使用。我在没有更改"autocrlf“设置的情况下,用git-svn签出了该文件。当提交到本地回购时,Git将结尾更改为\n。当推送到svn时,行尾仍然是\n

Fix

  • 与svn客户端结帐,更改行尾,提交。
  • 或者在git中将"autocrlf“设置为false。查看git-svn,更改行尾,提交。

如何在未来中避免

Git有一个设置为"autocrlf“。把它转过来似乎能解决这个问题

票数 2
EN

Stack Overflow用户

发布于 2017-10-02 06:18:29

它在执行以下步骤后得到解决

  1. scm标记(connection、developerconnection和url)和发布插件从父pom迁移到子pom。
  2. 在maven命令示例中使用-B选项:mvn -B -f pom.xml -DdevelopmentVersion=<developmentVersion> -DreleaseVersion=<releaseVersion> -Dusername=<scmUserName> -Dtag=<releaseVersion> -Dresume=false release:prepare release:perform versions:use-latest-releases -Dpassword=<scmPassword>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39407545

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档