当我在命令行上使用“ dependency:get”插件时,maven抛出了“未授权”错误。我该如何解决?
我尝试将服务器存储库添加到.m2 / settings.xml中。我的用户名和密码正确。我尝试使用相同的工件,并且可以通过IntelliJ中的pom.xml下载存储库。
这是我的maven命令行,失败了:
mvn org.apache.maven.plugins:maven-dependency-plugin:3.1.1:get \
-Dartifact=mygroup:myartifact:myversion:aar \
-DremoteRepositories=public::default::my.repository
.m2 / setting.xml
<servers>
<server>
<id>public</id>
<username>myuser</username>
<password>mypassword</password>
</server>
</servers>
.m2 / plugin-registry.xml
<?xml version="1.0" encoding="UTF-8"?>
<pluginRegistry xsi:schemaLocation="http://maven.apache.org/PLUGIN_REGISTRY/1.0.0 http://maven.apache.org/xsd/plugin-registry-1.0.0.xsd"
xmlns="http://maven.apache.org/PLUGIN_REGISTRY/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<useVersion>3.1.1</useVersion>
<rejectedVersions/>
</plugin>
</plugins>
</pluginRegistry>
我的pom.xml,成功了:
<dependency>
<groupId>mygroup</groupId>
<artifactId>myartifact</artifactId>
<version>myversion</version>
<type>aar</type>
</dependency>
<repositories>
<repository>
<id>public</id>
<name>Public Repositories</name>
<layout>default</layout>
<url>my.repository</url>
</repository>
</repositories>