我正在努力从 Maven 2 迁移到 Maven 3。我特意从消息和设置中删除了主机和端口。
Maven 2 目前可以很好地与我们在防火墙后面设置的 Artifactory 中央存储库配合使用。当我切换到使用 Maven 3 时,它无法下载插件并显示错误消息:
[错误] 插件 org.apache.maven.plugins:maven-install-plugin:2.3.1 或其依赖项之一无法解析:无法读取 org 的工件描述符。apache.maven.plugins:maven-install-plugin:jar:2.3.1: 无法从/到中央传输工件 org.apache.maven.plugins:maven-install-plugin:pom:2.3.1 (http:// :/artifactory/plugins-release): 拒绝访问: http://:/artifactory/plugins-release/org/apache/maven/plugins/maven-install-plugin/2.3.1/maven-install-plugin-2.3 .1.pom ,原因短语:禁止。
这是我的设置:
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<proxies>
<proxy>
<id>andy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxyip</host>
<port>80</port>
<username>user</username>
<password>password</password>
<nonProxyHosts>host</nonProxyHosts>
</proxy>
</proxies>
<servers>
<server>
<username>user</username>
<password>password</password>
<id>central</id>
</server>
<server>
<username>user</username>
<password>password</password>
<id>snapshots</id>
</server>
</servers>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://<host>:<port>/artifactory/libs-release</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://<host>:<port>/artifactory/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>http://<host>:<port>/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>http://<host>:<port>/artifactory/plugins-snapshot</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
我检查了工件中是否存在正确的插件和版本,这似乎是一个访问问题。配置需要更新的 Maven 2 和 Maven 3 之间是否发生了变化?