2011-11-14 62 views
3

我是Nexus的新手,並且正在嘗試針對我的單個Nexus服務器運行Maven項目。在運行該項目(Spring Roo示例已知可以正確構建和運行)中,除了兩個里程碑jar外,其他所有jar都已加載。我的答案(也許不是最好的)是直接找到並上傳罐(與POM的)到我的Nexus服務器(託管回購),然後我把它放在公共組。下載了神器,但未從我的單個Nexus服務器使用

當重新運行mvn項目(使用mvn包tomcat:run)時,2個文件似乎從服務器上下載(請參閱下面的控制檯輸出),但仍未找到mvn項目。爲什麼項目顯然會把它們叫掉但不使用它們?謝謝。

這裏是控制檯輸出顯示下載發生,但沒有被項目使用,我的settings.xml(問題的瓶頸是aspectjrt-1.6.11.M1和aspectjweaver-1.6.11.M1):

Last login: Mon Nov 14 06:03:25 on console 
Macintosh-2:~ wlaprise$ cd coursemanager/ 
Macintosh-2:coursemanager wlaprise$ mvn package tomcat:run 
[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building Course Manager Chapter 4 0.1.0.BUILD-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
Downloading: http://www.c3works.com:8081/nexus-webapp-1.9.1.1/content/repositories/public/org/aspectj/aspectjrt/1.6.11.M1/aspectjrt-1.6.11.M1.pom 
Downloaded: http://www.c3works.com:8081/nexus-webapp-1.9.1.1/content/repositories/public/org/aspectj/aspectjrt/1.6.11.M1/aspectjrt-1.6.11.M1.pom (909 B at 0.5 KB/sec) 
Downloading: http://www.c3works.com:8081/nexus-webapp-1.9.1.1/content/repositories/public/org/aspectj/aspectjweaver/1.6.11.M1/aspectjweaver-1.6.11.M1.pom 
Downloaded: http://www.c3works.com:8081/nexus-webapp-1.9.1.1/content/repositories/public/org/aspectj/aspectjweaver/1.6.11.M1/aspectjweaver-1.6.11.M1.pom (912 B at 1.0 KB/sec) 
Downloading: http://www.c3works.com:8081/nexus-webapp-1.9.1.1/content/repositories/public/org/springframework/roo/org.springframework.roo.annotations/1.2.0.BUILD-SNAPSHOT/maven-metadata.xml 
Downloading: http://www.c3works.com:8081/nexus-webapp-1.9.1.1/content/repositories/public/org/springframework/roo/org.springframework.roo.osgi.bundle/1.2.0.BUILD-SNAPSHOT/maven-metadata.xml 
Downloading: http://www.c3works.com:8081/nexus-webapp-1.9.1.1/content/repositories/public/org/springframework/roo/org.springframework.roo.root/1.2.0.BUILD-SNAPSHOT/maven-metadata.xml 
Downloading: http://www.c3works.com:8081/nexus-webapp-1.9.1.1/content/repositories/public/org/aspectj/aspectjrt/1.6.11.M1/aspectjrt-1.6.11.M1.jar 
Downloading: http://www.c3works.com:8081/nexus-webapp-1.9.1.1/content/repositories/public/org/aspectj/aspectjweaver/1.6.11.M1/aspectjweaver-1.6.11.M1.jar 
Downloaded: http://www.c3works.com:8081/nexus-webapp-1.9.1.1/content/repositories/public/org/aspectj/aspectjrt/1.6.11.M1/aspectjrt-1.6.11.M1.jar (1640 KB at 689.5 KB/sec) 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 13.607s 
[INFO] Finished at: Mon Nov 14 06:17:42 CST 2011 
[INFO] Final Memory: 5M/81M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal on project course-manager-chapter-04: Could not resolve dependencies for project org.rooinaction.coursemanager:course-manager-chapter-04:war:0.1.0.BUILD-SNAPSHOT: Could not find artifact org.aspectj:aspectjweaver:jar:1.6.11.M1 in nexus (http://www.c3works.com:8081/nexus-webapp-1.9.1.1/content/repositories/public) -> [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/DependencyResolutionException 
Macintosh-2:coursemanager wlaprise$ 

的settings.xml -

所有URL http://central
<settings> 
    <mirrors> 
     <mirror> 
      <!--This sends everything else to /public --> 
      <id>nexus</id> 
      <mirrorOf>*</mirrorOf> 
      <url>http://www.c3works.com:8081/nexus-webapp-1.9.1.1/content/repositories/public</url> 
     </mirror> 
    </mirrors> 
    <profiles> 
     <profile> 
      <id>nexus</id> 
      <!--all requests to nexus via the mirror --> 
      <repositories> 
       <repository> 
        <id>central</id> 
        <url>http://central</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> 
    </profiles> 
    <activeProfiles> 
     <activeProfile>nexus</activeProfile> 
    </activeProfiles> 
    <pluginGroups> 
     <pluginGroup>com.sonatype.maven.plugins</pluginGroup> 
     <pluginGroup>org.sonatype.plugins</pluginGroup> 
    </pluginGroups> 
</settings> 

回答

1

首先是罰款。這是一個虛擬佔位符,從未使用,因爲您定義了鏡像。

但是,您使用的鏡像網址很可能是錯誤的。通常,Nexus中的存儲庫被託管或代理,然後彙總到公共「組」中。

爲公衆論壇的網址默認URL是http://localhost:8081/nexus/content/groups/public/ 與本地主機替換爲您的服務器,如果你是進行代理背後Apache或80端口的

運行反正省略端口。主要的一點是,網址是/ content/GROUPS/public ..你的網址很可能是錯誤的。測試只是在瀏覽器中嘗試鏡像中的網址。

當然,您需要在公共組中添加所有您需要的存儲庫。

+0

感謝Manfred。這讓我回到了正軌。 –

+0

如果是這樣,你應該接受我的答案,你也應該看看免費的Nexus書更多細節.. –

+0

謝謝你的幫助:) –

0

由於您正在自己的Nexus服務器上運行,因此該jar在您配置的存儲庫上不可用。您應該將Spring Source里程碑,發行版和快照存儲庫添加到公共組。

OSS有一個Spring Source存儲庫的實例,它們有一個包含里程碑,發行版和快照的組url。鏈接是https://oss.sonatype.org/content/groups/springsource-all/

爲此,您應該添加一個指向https://oss.sonatype.org/content/groups/springsource-all/的代理存儲庫並將存儲庫策略設置爲快照。

然後,將新的存儲庫添加到公共組。最後,重建索引,Maven現在應該能夠找到該文件。

另外,下面是一些有用的鏈接,配置Spring與Nexus。 http://www.sonatype.com/people/2009/12/spring-maven-nexus-best-practices/ http://blog.springsource.com/2009/12/02/obtaining-spring-3-artifacts-with-maven/

相關問題