2016-01-08 111 views
0

嗨,我是Maven構建工具的初學者。我構建了一個簡單的Maven JavaEE項目,並試圖構建它遠程的nexus存儲庫。但我只能成功部署快照。部署版本提供了400個錯誤的請求錯誤。maven deploy不能用於發佈版本

這裏是我的Setting.xml配置

 <servers> 
      <server> 
        <id>****</id> 
        <username>****</username> 
        <password>****</password> 
      </server> 
    </servers> 

    <mirrors> 
     <mirror> 
       <id>nexus</id> 
       <mirrorOf>central</mirrorOf> 
       <url>http://******:8081/nexus/content/groups/net.******.timetrack/</url> 
     </mirror> 
    </mirrors> 

<profiles> 
    <profile> 
      <id>nexus</id> 
      <repositories> 
       <repository> 
        <id>*****</id> 
        <url>http://******:8081/nexus/content/groups/net.*******.timetrack/</url> 
        <releases><enabled>true</enabled></releases> 
        <snapshots><enabled>true</enabled></snapshots> 
       </repository> 
      </repositories> 

      <pluginRepositories> 
       <pluginRepository> 
        <id>******</id> 
        <url>http://******:8081/nexus/content/groups/net.******.timetrack/</url> 
        <releases><enabled>true</enabled></releases> 
        <snapshots><enabled>true</enabled></snapshots> 
       </pluginRepository> 
      </pluginRepositories> 
     </profile> 
</profiles> 

<activeProfiles> 
      <activeProfile>nexus</activeProfile> 
</activeProfiles> 

,這裏是我的pom.xml的分銷管理

<distributionManagement> 
     <repository> 
      <uniqueVersion>false</uniqueVersion> 
      <id>*****</id> 
      <name>******</name> 
      <url>http://*******:8081/nexus/content/groups/net.******.timetrack/</url> 
      <layout>default</layout> 
     </repository> 
     <snapshotRepository> 
      <uniqueVersion>true</uniqueVersion> 
      <id>*****</id> 
      <name>***** Snapshots</name> 
      <url>http://******:8081/nexus/content/repositories/snapshots/</url> 
      <layout>legacy</layout> 
     </snapshotRepository> 
    </distributionManagement> 

如果我運行mvn clean deploy與(一個快照)

<groupId>net.*****.*****</groupId> 
<artifactId>*****-**-****</artifactId> 
<version>1.4-SNAPSHOT</version> 
<packaging>war</packaging> 

然後成功部署到nexus存儲庫快照目錄。

如果我運行mvn clean deploy用(該剝離)

<groupId>net.*****.****</groupId> 
<artifactId>****-***-*****</artifactId> 
<version>1.4.1</version> 
<packaging>war</packaging> 

然後它給了400壞請求錯誤

這裏是日誌錯誤

[INFO] 
[INFO] --- maven-war-plugin:2.6:war (default-war) @ ****-****-***** --- 
[INFO] Packaging webapp 
[INFO] Assembling webapp [*****-time-tracker] in [/home/dilanka/Projects/time_tracker/samples/GitLab/****/***-time-tracker/target/*****-time-tracker-1.4] 
[INFO] Processing war project 
[INFO] Copying webapp resources [/home/dilanka/Projects/time_tracker/samples/GitLab/*****/****-time-tracker/src/main/webapp] 
[INFO] Webapp assembled in [115 msecs] 
[INFO] Building war: /home/dilanka/Projects/time_tracker/samples/GitLab/TimeTracker/*****-time-tracker/target/****-time-tracker-1.4.war 
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ ****-time-tracker --- 
[INFO] Installing /home/dilanka/Projects/time_tracker/samples/GitLab/TimeTracker/****-time-tracker/target/****-time-tracker-1.4.war to /home/dilanka/maven3-repo/net/*****/timetrack/****-time-tracker/1.4/****-time-tracker-1.4.war 
[INFO] Installing /home/dilanka/Projects/time_tracker/samples/GitLab/TimeTracker/****-time-tracker/pom.xml to /home/dilanka/maven3-repo/net/****/timetrack/****-time-tracker/1.4/****-time-tracker-1.4.pom 
[INFO] 
[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ ****-time-tracker --- 
Uploading: http://*****:8081/nexus/content/groups/net.*****.timetrack/net/****s/timetrack/***-time-tracker/1.4/****-time-tracker-1.4.war 
Uploading: http://*****:8081/nexus/content/groups/net.****.timetrack/net/****/timetrack/****-time-tracker/1.4/****-time-tracker-1.4.pom 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 27.790 s 
[INFO] Finished at: 2016-01-08T15:28:08+05:30 
[INFO] Final Memory: 32M/252M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project ****-time-tracker: Failed to deploy artifacts: Could not transfer artifact net.****.timetrack:*****-time-tracker:war:1.4 from/to ***** (http://*****:8081/nexus/content/groups/net.****.timetrack/): Failed to transfer file: http://*****:8081/nexus/content/groups/net.****.timetrack/net/*****/timetrack/*****-time-tracker/1.4/****-time-tracker-1.4.war. Return code is: 400, ReasonPhrase: Bad Request. -> [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 

如果任何身體請幫我解決這個問題。

謝謝。

回答

0

您可以將給定工件的版本版本一次部署到給定的Nexus實例。

如果您的Nexus中已經存在相同的版本,您會看到類似於您所看到的錯誤。

0
  <url>http://*******:8081/nexus/content/groups/net.****.timetrack/</url> 

您不能部署到一個組庫,改變這個URL是一個託管版本庫中的URL。