簡體   English   中英

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中心的代理嗎?

[R

我找到了解決方案,即使“mvn clean -U”仍然不起作用。 也許有人可以指出我正確的解決方案

1)插件不在中心位置。 你應該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選項

里卡多

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM