Maven Deploy无法解析元数据

时间:2017-09-25 16:53:57

标签: java git maven-release-plugin

尝试将更改上传到私有bitbucket repo并收到以下错误:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.538 s
[INFO] Finished at: 2017-09-25T12:40:40-04:00
[INFO] Final Memory: 24M/327M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project commonfiles: Failed to update metadata commonfiles:commonfiles/maven-metadata.xml: Could not parse metadata /path-to-maven-repository/maven-metadata-commonfiles.xml: unexpected character in markup < (position: END_TAG seen ...</versions>\n<<... @10:3) -> [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/MojoExecutionException

打开元数据文件,我可以看到一些Git风格的头部标记使XML无法解析。

<?xml version="1.0" encoding="UTF-8"?>
<metadata>
  <groupId>commonFiles</groupId>
  <artifactId>CommonFiles</artifactId>
  <versioning>
    <release>0.3</release>
    <versions>
      <version>0.3</version>
    </versions>
<<<<<<< HEAD
    <lastUpdated>20170922183241</lastUpdated>
=======
    <lastUpdated>20170922184047</lastUpdated>
>>>>>>> 2eef4b2ec679542fd7e996341a0913500cd117df
  </versioning>
</metadata>

作为参考,我使用的是最新版本的wagon-git和maven 3.3.9。

之前我偶尔会看到此错误弹出,并且能够通过删除元数据文件并再次部署来修复。现在已经尝试了几次,似乎没有任何改变。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

您正在查看的文件存在未解决的冲突,因为您可能已经进入当前分支。

您需要按照以下步骤操作:

  1. 解决所有存在冲突代码的文件中的冲突。

    <versioning>
         <release>0.3</release>
         <versions>
              <version>0.3</version>
         </versions>
         <lastUpdated>20170922184047</lastUpdated> 
         <!-- I've for example accepted the current change-->
    </versioning>
    
  2. 提交并推送已解决的更改

    git commit -am "sample"
    git push origin <yourBranch>