maven部署到nexus

时间:2013-03-18 07:59:21

标签: android maven

我的项目包含以下pom.xml

<?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>

现在当我在我的项目pom.xml文件上执行mvn部署时,我收到以下错误

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 repo工作正常,我可以使用上面的用户名和密码登录。我做错了什么?

亲切的问候

1 个答案:

答案 0 :(得分:3)

您无法部署到/content/groups/public - 在默认的Nexus安装上,这是一组存储库。 Nexus不知道将工件置于哪个底层存储库。试试/content/repositories/snapshots/