Search code examples
androidmavenpom.xmlnexus

How I can upload an apk file to the nexus repository manager?


I'm trying to publish an apk file to the maven. so in nexus repository manager (maven2 hosted) I can do this in some steps and here I can define file extension:

here I can define file extension

It's work fine and I can download apk file from nexus repo:

enter image description here

So now can I do same with pom.xml from cmd? Here is my pom.xml config:

enter image description here 4.0.0

  <groupId>android-maven-plugin</groupId>
  <artifactId>android</artifactId>
  <packaging>apk</packaging>
  <version>2.0.0</version>
  <name>my-maven</name>
  <url>http://maven.apache.org</url>
    

<distributionManagement>
    <repository>
        <id>android</id>
        <name>release softx</name>
        <url>http://#################.com/repository/android/</url>
    </repository>
    <snapshotRepository>
        <id>android</id>
        <name>snapshot softx</name>
        <url>http://#################.com/repository/android-snapshot/</url>
    </snapshotRepository>
</distributionManagement>
</project>

And I get this after run mvn deploy:

[INFO] Scanning for projects... [ERROR] [ERROR] Some problems were encountered while processing the POMs: [ERROR] Unknown packaging: apk @ line 7, column 14 @ [ERROR] The build could not read 1 project -> [Help 1] [ERROR] [ERROR] The project android-maven-plugin:android:2.0.0 (C:\search\meteor\androidapp\android\project\app\build\outputs\apk\release\pom.xml) has 1 error [ERROR] Unknown packaging: apk @ line 7, column 14 [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/ProjectBuildingException

If I use jar for packaging it's work fine. But I get a jar file in nexus and I can't use that.

enter image description here


Solution

  • I suspect you'll need to use github.com/sonatype-nexus-community/nexus-repository-apk otherwise you're bound by the restrictions of Maven (when using a Maven repo).