Nexus 和 Maven 构建
Nexus and Maven build
我已经安装并配置了 Nexus3。它在代理后面并且配置了 HTTP 部分。
[第一条评论后更新]
在我的 settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<servers/>
<proxies/>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://nexus.company.it:8081/repository/maven-central/</url>
</mirror>
</mirrors>
</settings>
当我尝试 运行 mvn clean
我得到
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building xxxx Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.apache.maven.plugins:maven-clean-plugin:jar:2.5 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.205 s
[INFO] Finished at: 2016-05-31T10:40:58+02:00
[INFO] Final Memory: 13M/479M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-clean-plugin:jar:2.5 in http://nexus.company.it:8081/repository/maven-central/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
如果我浏览http://nexus.company.it:8081/repository/maven-central/
Nexus Repository Manager
OSS 3.0.0-03
This maven2 proxy repository is not directly browseable at this URL.
如果我浏览 http://nexus.company.it:8081/#browse/browse/components:maven-central,存储库是空的
有人可以帮我配置我的 nexus 作为 maven central 的代理吗?
R
我找到了解决方案,即使 "mvn clean -U" 仍然不起作用。也许有人可以指出我正确的解决方案
1) 插件不在 maven-central 中。您应该将 maven-public 分组为 maven-central 和 maven-releases/snapshots
2) 我在 Nexus3 中禁用了匿名登录。所以我需要创建一个用户来连接到 Nexus3。这里有最后的 settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<profiles/>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>XXX.XXX.XXX.XXX</host>
<port>XXX</port>
<nonProxyHosts>XXX.XXX.*|*localhost*|*.company.it*</nonProxyHosts>
</proxy>
</proxies>
<servers>
<server>
<id>nexus</id>
<username>XXXXXXXXXX</username>
<password>XXXXXXXXXX</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://nexus.company.it:8081/repository/maven-public/</url>
</mirror>
</mirrors>
<activeProfiles/>
</settings>
3) 使用 mvn
时添加 -U 选项
里卡多
我已经安装并配置了 Nexus3。它在代理后面并且配置了 HTTP 部分。
[第一条评论后更新]
在我的 settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<servers/>
<proxies/>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://nexus.company.it:8081/repository/maven-central/</url>
</mirror>
</mirrors>
</settings>
当我尝试 运行 mvn clean
我得到
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building xxxx Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.apache.maven.plugins:maven-clean-plugin:jar:2.5 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.205 s
[INFO] Finished at: 2016-05-31T10:40:58+02:00
[INFO] Final Memory: 13M/479M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not be resolved: Failure to find org.apache.maven.plugins:maven-clean-plugin:jar:2.5 in http://nexus.company.it:8081/repository/maven-central/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
如果我浏览http://nexus.company.it:8081/repository/maven-central/
Nexus Repository Manager
OSS 3.0.0-03
This maven2 proxy repository is not directly browseable at this URL.
如果我浏览 http://nexus.company.it:8081/#browse/browse/components:maven-central,存储库是空的
有人可以帮我配置我的 nexus 作为 maven central 的代理吗?
R
我找到了解决方案,即使 "mvn clean -U" 仍然不起作用。也许有人可以指出我正确的解决方案
1) 插件不在 maven-central 中。您应该将 maven-public 分组为 maven-central 和 maven-releases/snapshots
2) 我在 Nexus3 中禁用了匿名登录。所以我需要创建一个用户来连接到 Nexus3。这里有最后的 settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<profiles/>
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>XXX.XXX.XXX.XXX</host>
<port>XXX</port>
<nonProxyHosts>XXX.XXX.*|*localhost*|*.company.it*</nonProxyHosts>
</proxy>
</proxies>
<servers>
<server>
<id>nexus</id>
<username>XXXXXXXXXX</username>
<password>XXXXXXXXXX</password>
</server>
</servers>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://nexus.company.it:8081/repository/maven-public/</url>
</mirror>
</mirrors>
<activeProfiles/>
</settings>
3) 使用 mvn
时添加 -U 选项里卡多