首页 > 解决方案 > maven-dependency-plugin 依赖:获取 AAR 依赖

问题描述

我想获取一个包含所有依赖项的 Maven 包。为此,我使用以下命令:

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

我的 settings.xml 文件:

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

如果依赖关系树中没有 aar 包,它可以正常工作,否则,对于每个 aar 包,我都会出现如下错误:

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

有一个插件可以管理 aar 和其他 android 存档格式(com.simligility.maven.plugins:android-maven-plugin),但我不知道如何使用它来执行与 maven 相同的事情-dependency-plugin 与 get 方法

标签: mavencommand-line-interfaceaarmaven-dependency-plugin

解决方案


推荐阅读