通过maven将apklib文件部署到nexus

时间:2013-03-30 06:50:41

标签: android maven

我在我的项目中使用android-saripaar库。现在我想将这个库部署到我的内部nexus存储库。我已将分发管理标记添加到上述库的pom.xml文件中。这是完整的库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.mobsandgeeks.saripaar</groupId>
    <artifactId>android-saripaar</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>android-saripaar</name>
    <packaging>apklib</packaging>

    <properties>
        <java.version>1.6</java.version>
    </properties>

    <distributionManagement>
        <repository>
            <id>confiz-repo</id>
            <url>http://10.10.10.230:8081/nexus/content/repositories/snapshots/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
        </repository>
     </distributionManagement>

    <dependencies>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <scope>provided</scope>
            <version>4.1.1.4</version>
        </dependency>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>support-v4</artifactId>
            <version>r7</version>
        </dependency>
    </dependencies>

    <build>
        <sourceDirectory>src</sourceDirectory>

        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.4.1</version>
                <configuration>
                    <sdk>
                        <platform>16</platform>
                    </sdk>
                </configuration>
            </plugin>

            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.4.1</version>
                <extensions>true</extensions>
                <configuration>
                    <nativeLibrariesDirectory>ignored</nativeLibrariesDirectory>
                </configuration>
            </plugin>

        </plugins>

    </build>
</project>

现在在我希望用maven构建的目标项目中,我已经包含了以下依赖项

        com.mobsandgeeks.saripaar         Android的saripaar         1.0-SNAPSHOT     

我的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>
    <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/repositories/snapshots/</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部署,这使得构建成功。我去了distriubution管理中提到的路径,我可以在那里看到我的项目。

现在在第二个项目中,我按如下方式访问文件

<dependency>
            <groupId>com.mobsandgeeks.saripaar</groupId>
            <artifactId>android-saripaar</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>

当我在项目上运行mvn clean install时,它会给我一个构建错误,maven找不到我提到的工件?我做错了什么?

亲切的问候

0 个答案:

没有答案