遇到如下问题“Failed to transfer file: http://skf-nexus.xxxxx.com/re… Return code is: 401”
找一台有 maven 的机器批改配置
[root@dev-technology-215l ~]# cat /usr/local/apache-maven-3.3.9/conf/settings.xml
<settings>
<mirrors>
<!-- 给定仓库的下载镜像。-->
<mirror>
<!-- 该镜像的惟一标识符。id 用来辨别不同的 mirror 元素。-->
<id>xxxxx</id>
<!-- 镜像名称 -->
<name>Nexus xxxxx</name>
<!-- 该镜像的 URL。构建零碎会优先思考应用该 URL,而非应用默认的服务器 URL。-->
<url>http://nexus.xxxxx.com/repository/xxxxx-maven-central/</url>
<!-- 被镜像的服务器的 id。例如,如果咱们要设置了一个 Maven 地方仓库(http://repo1.maven.org/maven2)的镜像,-->
<!-- 就须要将该元素设置成 central。这必须和地方仓库的 id central 完全一致。-->
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
<profiles>
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
<profile>
<id>dev</id>
<repositories>
<repository>
<id>nexus</id>
<url>http://skf-nexus.xxxxx.com/repository/xxxxx-release/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>dev</activeProfile>
</activeProfiles>
<servers>
<server>
<id>releases</id>
<username>admin</username>
<password>xxxxx-0312</password>
</server>
<server>
<id>snapshots</id>
<username>admin</username>
<password>xxxxx-0312</password>
</server>
</servers>
<distributionManagement>
<repository>
<id>xxxxx-releases</id>
<name>Nexus Release Repository</name>
<url>http://skf-nexus.xxxxx.com/repository/xxxxx-release/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Nexus Snapshot Repository</name>
<url>http://skf-nexus.xxxxx.com/repository/snapshots/</url>
</snapshotRepository>
</distributionManagement>
</settings>
jar 包上传命令
mvn deploy:deploy-file -DgroupId=com.csii.pe.http -DartifactId=security -Dversion=1.3 -Dpackaging=jar -Dfile=”/tmp/maventest/com-csii-pe-http-security-1.3.jar” -Durl=http://skf-nexus.xxxxx.com/re… -DrepositoryId=releases