【发布时间】:2021-04-28 16:19:26
【问题描述】:
我想将我的 aar 库包推送到 Github 包。 我用我的 github 包链接和所有依赖项创建了一个 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.mypackage.package</groupId>
<artifactId>myartifact</artifactId>
<packaging>aar</packaging>
<version>0.0.1</version>
<name>My Package</name>
<url>https://mywebsite.com</url>
<build>
<plugins>
<plugin>
<groupId>com.simpligility.maven.plugins</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>4.1.0</version>
<extensions>true</extensions>
<configuration>
<sign>
<debug>false</debug>
</sign>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
</dependency>
<dependency>
<groupId>androidx.lifecycle</groupId>
<artifactId>lifecycle-extensions</artifactId>
<version>2.2.0</version>
<type>pom</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>androidx.fragment</groupId>
<artifactId>fragment</artifactId>
<version>1.3.3</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>androidx.recyclerview</groupId>
<artifactId>recyclerview</artifactId>
<version>1.2.0</version>
<type>pom</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>androidx.recyclerview</groupId>
<artifactId>recyclerview-selection</artifactId>
<version>1.1.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.android.volley</groupId>
<artifactId>volley</artifactId>
<version>1.2.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>androidx.appcompat</groupId>
<artifactId>appcompat</artifactId>
<version>1.2.0</version>
<type>pom</type>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.android.material</groupId>
<artifactId>material</artifactId>
<version>1.3.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>androidx.legacy</groupId>
<artifactId>legacy-support-v4</artifactId>
<version>1.0.0</version>
<type>pom</type>
<scope>runtime</scope>
</dependency>
</dependencies>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>maven_central_repo</id>
<name>Maven repo</name>
<url>https://maven.google.com/</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/myrepo/myrepo</url>
</repository>
</distributionManagement>
</project>
部署时,我收到以下错误:
The following artifacts could not be resolved: androidx.fragment:fragment:jar:1.0.0
我收到了从 Google Maven 存储库下载的所有 androidx 依赖项的错误。
我的文件似乎将 androidx.fragment 作为 jar 文件,即使我将类型指定为 pom。
如何获取 androidx 依赖项?
感谢您的帮助。
【问题讨论】:
-
您已配置 Maven/Gradle Google 存储库,但您使用的 id 和名称属于不同的存储库。可能会让 Maven 感到困惑。使用唯一的 ID 和名称。
-
谢谢。如何找到正确的 ID?
-
您可以定义 ID,它必须是唯一的。最好使用反映存储库的东西,例如
<id>Google</id>。
标签: android maven pom.xml android-library