我尝试使用https://docs.gitlab.com/ee/user/project/packages/maven_repository.html来托管我的aar文件,我的操作与文档完全相同,但是我未能上传aar。我像这样设置pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>mygroup.id</groupId>
<artifactId>myartifact</artifactId>
<version>0.1.2</version>
<packaging>aar</packaging>
<repositories>
<repository>
<id>myrepo</id>
<url>https://gitlab.com/api/v4/projects/1968/packages/maven</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>myrepo</id>
<url>https://gitlab.com/api/v4/projects/1968/packages/maven</url>
</repository>
<snapshotRepository>
<id>myrepo</id>
<url>https://gitlab.com/api/v4/projects/1968/packages/maven</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>de.greenrobot</groupId>
<artifactId>eventbus</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
<version>28.0.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger</artifactId>
<version>2.11</version>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>retrofit</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>converter-gson</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.squareup.retrofit2</groupId>
<artifactId>retrofit-mock</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>3.8.1</version>
</dependency>
<dependency>
<groupId>android.arch.lifecycle</groupId>
<artifactId>runtime</artifactId>
<version>1.1.1</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>android.arch.lifecycle</groupId>
<artifactId>extensions</artifactId>
<version>1.1.1</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>android.arch.lifecycle</groupId>
<artifactId>common-java8</artifactId>
<version>1.1.1</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>io.nlopez.smartlocation</groupId>
<artifactId>library</artifactId>
<version>3.3.1</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>play-services-location</artifactId>
<version>16.0.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>android.arch.lifecycle</groupId>
<artifactId>livedata</artifactId>
<version>1.1.1</version>
<type>pom</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.simpligility.maven.plugins</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>4.5.0</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
以及我的~/.m2/settings.xml
像这样:
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<servers>
<server>
<id>myrepo</id>
<configuration>
<httpHeaders>
<property>
<name>Private-Token</name>
<value>myprivatetoken</value>
<scope>api</scope>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
由于出现以下错误:
无法对项目kudosdk执行目标:无法解决项目mobile.kudo.kudosdk:kudosdk:aar:0.1.2的依赖项:无法解析以下工件:com.android.support:support-v4:pom :28.0.0 .......并且列表转到缺少pom文件的所有依赖项。但是,如果我从pom.xml中删除依赖项,则会出现错误,提示error during copyManifest
并指向清单存在的位置。
如果我将包装更改为pom
,它也可以成功地部署到我的gitlab存储库中,但是它只是pom文件,没有部署aar文件,而且我不确定如何通过gradle获取依赖项。我尝试使用
implementation 'groupid:module:version'
,但未能说明未能解决依赖关系,这意味着该依赖关系不存在。
任何帮助将不胜感激,我已经努力4天来解决这个问题。谢谢