android - maven部署到nexus

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

亲切的问候

最佳答案

您不能部署到 /content/groups/public - 在默认的 Nexus 安装中,这是一组存储库。 Nexus 不知道将 Artifact 放在哪个底层存储库中。试试 /content/repositories/snapshots/

关于android - maven部署到nexus,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15472065/

相关文章:

android - 如何从接收器调用服务

android - Overlay.draw() 多次调用

android - 如何在 Fragment TabHost 中获取当前选中的 Fragment

javascript - 从应用程序发送带有附件的电子邮件

java - 为什么我的 java -version 与我在 mvn --version 中看到的不同

java - 从 ant 类路径中排除 jar

java - 如何让 JRE 与 launch4j 捆绑在一起?

java - 使用 Excelsior-jet maven 插件构建多组件应用程序

java - CQ5 OSGi Bundle 错误 - org.json.simple -- 无法解决

android - 如何执行 graph-api Facebook Android SDK