2015-09-07 131 views
1

我在我的64位本地主機Windows上安裝了nexus-2.11。我通過ant任務在Eclipse中運行mvnbuild.xml。我已經設置了關係服務器.m2/settings.xml作爲主鏡:本地主機上的Sonatype Nexus服務器不緩存工件

<mirror> 
     <id>nexus</id> 
     <mirrorOf>*</mirrorOf> 
     <url>http://localhost:8081/nexus/content/groups/public/</url> 
</mirror> 

當運行mvn命令,依賴性都解決了,它是在日誌中表明,他們正在從Nexus的服務器下載。問題在於Nexus緩存:Nexus不會緩存任何內容。我的意思是sonatype-work文件夾是空的,所有工件都在.m2之內。

在管理面板中登錄,我可以看到工件的完整索引,但在sonatype-work內沒有jar文件或元數據。 (下載所有文物後,由於安全原因,我想將sonatype-work的內容放入離線的主服務器中。)

這是什麼原因造成的?

+0

Nexus過程(Jetty,我相信)可以寫入文件夾'sonatype-work'嗎? – JimHawkins

+0

是的。我也嘗試以管理員身份運行它,甚至移動到另一個驅動器。 – user3399000

回答

0

sonatype-work/README.txt,我的環境變量PLEXUS_NEXUS_WORK設置爲sonatype-work的路徑,然後,開始的Nexus緩存到工作文件夾。

使用環境變量可以覆蓋單個工作文件夾的位置。例如,可以使用PLEXUS_NEXUS_WORK定義Nexus工作位置。如果未定義,則使用此默認值。

0

你在settings.xmlprofiles部分插入了類似的東西嗎?

<profile> 
     <id>company-nexus</id> 
     <repositories> 
      <repository> 
       <id>central</id> 
       <url>http://central</url> <!-- use a not existing URL!! --> 
       <releases> 
        <enabled>true</enabled> 
       </releases> 
       <snapshots> 
        <enabled>true</enabled> 
       </snapshots> 
      </repository> 
     </repositories> 
     <pluginRepositories> 
      <pluginRepository> 
       <id>central</id> 
       <url>http://central</url> 
       <releases> 
        <enabled>true</enabled> 
       </releases> 
       <snapshots> 
        <enabled>true</enabled> 
       </snapshots> 
      </pluginRepository> 
     </pluginRepositories> 
    </profile> 

這會導致maven查找mirror定義。

+0

是的,我做到了。在運行命令時會顯示消息,例如「下載:http:// localhost:8081/nexus/content/groups/public/...」。所以,它_does_看看鏡像定義。 – user3399000

相關問題