Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/341.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Maven发布插件由于jenkins中的局部修改而中止准备_Java_Maven_Svn_Jenkins_Maven Release Plugin - Fatal编程技术网

Java Maven发布插件由于jenkins中的局部修改而中止准备

Java Maven发布插件由于jenkins中的局部修改而中止准备,java,maven,svn,jenkins,maven-release-plugin,Java,Maven,Svn,Jenkins,Maven Release Plugin,问题: 当我执行maven发布插件的prepare目标时,我得到了一个错误 [错误]无法在项目上执行目标org.apache.maven.plugins:maven发行版plugin:2.3.2:prepare(默认cli)我的工件id:无法准备发行版,因为您有本地修改: [错误][我的项目名称\src\main\java\some\packages\SomeJavaSourceFile.java:modified] [错误][我的项目名称\src\main\java\some\package

问题:

当我执行maven发布插件的prepare目标时,我得到了一个错误

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

[错误][我的项目名称\src\main\java\some\packages\SomeJavaSourceFile.java:modified]

[错误][我的项目名称\src\main\java\some\packages\SomeOtherJavaSourceFile.java:modified]

大约20个文件

详细信息

  • 发布插件由Jenkins执行
  • SVN配置为“始终签出新副本”
  • Maven release插件用于目标
    -Dresume=false clean release:prepare release:perform
  • 在上次提交中修改了修改的文件
  • 在执行准备目标期间发生错误: [信息]---maven发布插件:2.3.2:prepare(默认cli)@artifact id

  • 该发布插件在过去11次成功运行(但有时在第一次尝试时不起作用,但在第二次尝试时起作用)
类似问题

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

  • :我不想忽略此文件。它们应该是发布的一部分
  • :修改后的文件不在目标目录中,也不是修改的pom.xml文件
日志

我试图匿名,所以你发现一些零件被替换为[替换零件的含义]

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

概述

提交的文件只有
\n
(=
lf
=
换行符
)作为以subversion结尾的行。它们是在windows计算机上签出的,因此结尾变成了
\r\n
(=
crlf
=
回车和换行
)。因此,文件已更改为“已修改”。若要修复该问题,请签入以直接结束的
\r\n
-文件

查找方法

  • 在Jenkins上重新签出后,您可以运行“svn状态”作为SKcript来查看文件是否标记为“已修改”
  • 当您调用“svn diff”时,您将看到,每行中的每个文件都不同,但您没有看到任何差异=>不可见的更改
  • 从jenkins workspace和svn repo中分别打开一个这样修改过的文件,并使用能够可视化不可见字符的编辑器查看它们(例如,记事本++和工具栏中的“显示所有字符”)
原因

发生这种情况的原因是git svn的错误使用。我使用git svn签出了文件,但没有更改“autocrlf”设置。git在提交到本地repo时将结尾更改为
\n
。当推到svn时,行结尾保持为
\n

修复

  • 与svn客户端签出、更改行结尾、提交
  • 或者在git中将“autocrlf”设置为
    false
    。使用git svn签出,更改行尾,dcommit
未来如何避免

- root-dir
|- module-1-dir
|'- module-1-pom
|- module-2-dir
|'- module-1-pom
| ...
'-root-pom

Git有一个设置“autocrlf”。将其关闭似乎可以解决问题

执行以下步骤后,问题得到解决

  • scm标记(连接、developerconnection和url)和发布插件从父pom移动到子pom
  • 在maven命令中使用了
    -B
    选项 示例:
    mvn-B-f pom.xml-DdevelopmentVersion=-dreleasevervion=-Dusername=-Dtag=-Dresume=false发布:准备发布:执行版本:使用最新版本-Dpassword=

  • 首先,你为什么要使用这样一个旧版本的maven发布插件?在发布步骤之前是否有修改文件的步骤?如果没有完整的日志输出,很难看出有什么问题..我添加了整个日志(匿名)对于这个问题,我使用maven 3.3.9和默认定义的发布插件版本强制使用org.apache.maven.plugins:maven发布插件:2.5.3并不能解决问题(相同的错误)根pom位于哪里?项目的结构(文件夹结构)如何?在问题中添加项目结构:根pom在根目录中。谢谢你的回答。不幸的是,我不再参与该项目,因为我遇到了这个问题。因此我无法验证它。我希望它能帮助其他人。