2013-03-18 103 views
1

我的項目包含以下的pom.xml行家部署到NEXUS

<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.onestopspot</groupId> 
    <artifactId>api_library</artifactId> 
    <version>5.0.0-SNAPSHOT</version> 
    <packaging>apk</packaging> 
    <name>One Stop Spot</name> 
    <distributionManagement> 
     <repository> 
      <id>confiz-repo</id> 
      <url>http://10.10.10.230:8081/nexus/content/groups/public</url> 
      <releases> 
       <enabled>true</enabled> 
      </releases> 
      <snapshots> 
       <enabled>true</enabled> 
       <updatePolicy>always</updatePolicy> 
      </snapshots> 
     </repository> 
    </distributionManagement> 
    <dependencies> 
     <dependency> 
      <groupId>org.springframework.android</groupId> 
      <artifactId>spring-android-rest-template</artifactId> 
      <version>1.0.0.RELEASE</version> 
     </dependency> 

     <dependency> 
      <groupId>org.codehaus.jackson</groupId> 
      <artifactId>jackson-mapper-asl</artifactId> 
      <version>1.9.8</version> 
     </dependency> 
     <dependency> 
      <groupId>com.google.android</groupId> 
      <artifactId>android</artifactId> 
      <version>4.1.1.4</version> 
      <scope>provided</scope> 
     </dependency> 
    </dependencies> 


    <build> 
     <finalName>${project.artifactId}</finalName> 
     <sourceDirectory>src/main/java</sourceDirectory> 
     <pluginManagement> 
      <plugins> 
       <plugin> 
        <groupId>com.jayway.maven.plugins.android.generation2</groupId> 
        <artifactId>android-maven-plugin</artifactId> 
        <version>3.4.0</version> 
        <extensions>true</extensions> 
       </plugin> 
      </plugins> 
     </pluginManagement> 
     <plugins> 
      <plugin> 
       <groupId>com.jayway.maven.plugins.android.generation2</groupId> 
       <artifactId>android-maven-plugin</artifactId> 
       <configuration> 
        <sdk> 
         <platform>16</platform> 
        </sdk> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

,並在我的Maven的conf文件夾我的settings.xml文件包含以下信息

<?xml version="1.0" encoding="UTF-8"?> 

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> 
    <pluginGroups> 
    </pluginGroups> 

    <proxies> 
    </proxies> 

    <servers> 
    <server> 
     <id>confiz-repo</id> 
     <username>admin</username> 
     <password>admin123</password> 
    </server> 
    </servers> 

    <mirrors> 
    <mirror> 
     <!-- The id of this mirror and the server instance above needs to be the same!--> 
     <id>confiz-repo</id> 
     <mirrorOf>*</mirrorOf> 
     <url> http://10.10.10.230:8081/nexus/content/groups/public/</url> 
    </mirror> 
    </mirrors> 

    <profiles> 
    <profile> 
     <id>nexus</id> 
     <!--Enable snapshots for the built in central repo to direct --> 
     <!--all requests to nexus via the mirror --> 
     <repositories> 
     <repository> 
      <id>confiz-repo</id> 
      <url>http://central</url> 
      <releases> 
     <enabled>true</enabled> 
     </releases> 
      <snapshots> 
     <enabled>true</enabled> 
     <updatePolicy>always</updatePolicy> 
     </snapshots> 
     </repository> 
     </repositories> 
     <pluginRepositories> 
     <pluginRepository> 
      <id>confiz-repo</id> 
      <url>http://central</url> 
      <releases> 
     <enabled>true</enabled> 
     </releases> 
      <snapshots> 
     <enabled>true</enabled> 
     </snapshots> 
     </pluginRepository> 
     </pluginRepositories> 
    </profile> 
    </profiles> 


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

</settings> 

現在,當我做了MVN部署在我的項目pom.xml文件我得到以下錯誤

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project api_library: Failed to deploy artifacts: Could not transfer artifact com.onestopspot:api_library:apk:5.0.0-20130318.070710-1 from/to confiz-repo (http://10.10.10.230:8081/nexus/content/groups/public): Failed to transfer file: http://10.10.10.230:8081/nexus/content/groups/public/com/onestopspot/api_library/5.0.0-SNAPSHOT/api_library-5.0.0-20130318.070710-1.apk. Return code is: 400 

我的nexus回購工作正常,我可以登錄使用上面的用戶名和密碼。我究竟做錯了什麼 ?

親切的問候

回答

3

您不能部署到/content/groups/public - 在默認安裝的Nexus,這是一組庫。 Nexus不知道哪個底層存儲庫放置了它的神器。試試/content/repositories/snapshots/

+0

好的謝謝。這對我有效。現在分發管理標籤是否必須將其放在我的pom文件中,或者我可以將它放在settings.xml文件中? – user1730789 2013-03-18 08:55:56

+1

我認爲它在pom文件中更有意義,因爲它是特定於項目的 – artbristol 2013-03-18 09:03:20