将maven项目推送(部署)到Nexus 3

时间:2016-12-12 13:31:30

标签: maven jenkins deployment nexus

我尝试将我的项目推送到Nexus 3,但每次遇到同样的问题时(记录如下)。

配置: pom.xml

<nexus.url>http://adress/#browse/browse/components:docker-image</nexus.url>

<distributionManagement>
   <snapshotRepository>
        <id>nexus</id>
        <url>${nexus.url}</url>
    </snapshotRepository>
</distributionManagement>
...
<plugins>
        <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>1.6.4</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>nexus</serverId>
              <nexusUrl>${nexus.url}</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
            </configuration>
        </plugin>

我有文件settings.xml:

<servers>
 <server>
    <id>nexus</id>
    <username>login</username>
    <password>password</password>
 </server>
</servers>

然后我尝试&#34; mvn deploy&#34;结果是:

[INFO] Deploying remotely...
[INFO]  * Bulk deploying locally gathered snapshot artifacts to URL http://adress/#browse/browse/components:docker-image
Downloading: http://adress/#browse/browse/components:/myProjectSource/0.1-SNAPSHOT/maven-metadata.xml
[WARNING] Checksum validation failed, expected <!DOCTYPE but is c90f8bc4e18b8c79c2df61e2ec9288e33fd8985f for http://adress/#browse/browse/components:/myProjectSource/0.1-SNAPSHOT/maven-metadata.xml
[WARNING] Could not validate integrity of download from http://adress/#browse/browse/components:/myProjectSource/0.1-SNAPSHOT/maven-metadata.xml Checksum validation failed, expected <!DOCTYPE but is c90f8bc4e18b8c79c2df61e2ec9288e33fd8985f
[WARNING] Checksum validation failed, expected <!DOCTYPE but is c90f8bc4e18b8c79c2df61e2ec9288e33fd8985f for http://adress/#browse/browse/components:/myProjectSource/0.1-SNAPSHOT/maven-metadata.xml
Downloaded: http://adress/#browse/browse/components:/myProjectSource/0.1-SNAPSHOT/maven-metadata.xml (5 KB at 13.3 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:56 min
[INFO] Finished at: 2016-12-12T14:15:55+01:00
[INFO] Final Memory: 75M/744M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.4:deploy (injected-nexus-deploy) on project someProject:
Failed to update metadata myProjectSource:0.1-SNAPSHOT/maven-metadata.xml: 
Could not parse metadata /home/test/.m2/repository/myProjectSource/0.1-SNAPSHOT/maven-metadata-nexus.xml: entity reference names can not start with character '&' (position: START_TAG seen ...ascript">\n    function progressMessage(msg) {\n      if (console &&... @33:21) -> [Help 1]

你知道问题出在哪里吗?

1 个答案:

答案 0 :(得分:1)

我找到了解决方案。问题出在nexus网址上。 当我改变网址

从:

<nexus.url>http://adress/#browse/browse/components:docker-image</nexus.url>

为:

<nexus.url>http://adress/repository/image-docker/</nexus.url>

工作正常。