0

I would like to fetch a maven package with all dependencies. To perform this, I use this command:

mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.1:get \
            --settings settings.xml                            \
            -Dmaven.repo.local=/path/to/m2-repository          \
            -Dartifact=my.pkg.name:vers

My settings.xml file :

<settings>
  <profiles>
    <profile>
      <id>global</id>
      <repositories>
        <repository>
          <id>google</id>
          <name>Google Maven</name>
          <url>https://maven.google.com</url>
        </repository>
        <repository>
          <id>jcenter</id>
          <name>Jcenter</name>
          <url>https://jcenter.bintray.com</url>
        </repository>
      </repositories>
    </profile>
  </profiles>

  <activeProfiles>
    <activeProfile>global</activeProfile>
  </activeProfiles>
</settings>

It's works fine if there are no aar packages in the dependency tree, otherwise, for each aar packages, I have the error like :

The following artifacts could not be resolved: <pkg-prefix>:<pkg-name>:jar:<pkg-version>

There is a plug-in to manage aar and other android archive formats (com.simpligility.maven.plugins:android-maven-plugin) but I don't know how I will have to use it to perform the same thing that with maven-dependency-plugin with the get method

Emeric Verschuur
  • 553
  • 1
  • 4
  • 9
  • What about defining the `packaging` ? Cause I assume the packaging is `aar`? – khmarbaise Aug 01 '18 at 15:38
  • if I perform a: mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.1:get --settings settings.xml -Dmaven.repo.local=/path/to/m2-repository -Dartifact=my.pkg.name:vers:aar it's works only for the specified package and don't work for the dependencies... – Emeric Verschuur Aug 02 '18 at 07:05
  • Have you taken a look into the aar package pom file ? Are there any dependencies defined? – khmarbaise Aug 02 '18 at 07:18
  • When I try: `mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.1:get --settings settings.xml -Dmaven.repo.local=$PWD/opt/m2-repository -Dartifact=com.android.databinding:library:3.2.0-beta05` where POM file (packaging=aar OK) is https://maven.google.com/com/android/databinding/library/3.2.0-beta05/library-3.2.0-beta05.pom, it try to download https://maven.google.com/com/android/databinding/library/3.2.0-beta05/library-3.2.0-beta05.jar instead of .aar file – Emeric Verschuur Aug 02 '18 at 11:53
  • Duplicate of: https://stackoverflow.com/questions/32022842/transitive-aar-dependencies-an ifin-maven https://stackoverflow.com/questions/37903371/maven-refuse-to-download-aar-packaged-dependency-from-remote-repository – user202729 Mar 21 '20 at 15:45

0 Answers0