2013-01-05 26 views
3

使用Nexus時無法編譯Spring Roo(1.2.3.RELEASE)項目。使用Nexus時無法編譯Spring Roo項目

MVN說找不到roo.annotations:罐子

[ERROR] Failed to execute goal on project Roo123: Could not resolve dependencies for project com.example.roo:Roo123:jar:0.1.0.BUILD-SNAPSHOT: Failure to find org.springframework.roo:org.springframework.roo.annotations:jar:1.2.3.RELEASE in http://192.168.16.232:8081/nexus/content/groups/public 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] 

但是這個罐子已經在本地Maven倉庫。

當禁用Nexus時,通過重命名.m2 \ settings.xml,它工作正常。

的settings.xml剛剛1個鏡配置

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

如何配置的Nexus?

(添加http://spring-roo-repository.springsource.org/release作爲代理庫並不會幫助)

UPDATE:添加圖片。在左側添加spring-roo-repository無濟於事。 以下兩個長答案也無濟於事。

Nexus public

回答

1

這是不夠的,配置的mirrorof只有你必須進行以下配置:

<settings> 
    <mirrors> 
    <mirror> 
     <!--This sends everything else to /public --> 
     <id>nexus</id> 
     <mirrorOf>*</mirrorOf> 
     <url>http://localhost:8081/nexus/content/groups/public</url> 
    </mirror> 
    </mirrors> 
    <profiles> 
    <profile> 
     <id>nexus</id> 
     <!--Enable snapshots for the built in central repo to direct --> 
     <!--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> 
    <!--make the profile active all the time --> 
    <activeProfile>nexus</activeProfile> 
    </activeProfiles> 
</settings> 

除了你的配置,你需要刪除本地倉庫並重新構建。您是否正確配置了Nexus以訪問像Maven Central等互聯網?

+0

我不明白。爲什麼我需要創建配置文件並將其激活? 什麼意思中央什麼時候一切都已經在content/groups/public?並刪除本地存儲庫(如果它沒有損壞)通常是不好的建議。 –

1

我不知道您是否有管理員訪問您的Nexus安裝,但您必須將a new proxy repository添加到您的Nexus安裝中。

你必須添加回購是

http://spring-roo-repository.springsource.org/release 

你應該有一個設置文件中像下面(比khmarbaise的版本略有不同):

<settings 
    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> 
     <servers> 
      <server> 
       <id>central</id> 
       <username>your-user</username> 
       <password>your-user</password> 
      </server> 
      <server> 
       <id>mirror</id> 
       <username>your-user</username> 
       <password>your-user</password> 
      </server> 
     </servers> 
     <mirrors> 
     <mirror> 
      <id>mirror</id> 
      <url>https://url.to.your.nexus</url> 
      <mirrorOf>*</mirrorOf> 
     </mirror> 
     </mirrors> 
     <profiles> 
      <profile> 
       <id>defaultprofile</id> 
       <repositories> 
        <repository> 
         <id>central</id> 
        <name>Repository for your artifacts</name> 
         <url>https://url.to.your.nexus</url> 
         <releases> 
          <enabled>true</enabled> 
        </releases> 
         <snapshots> 
          <enabled>true</enabled> 
        </snapshots> 
        </repository> 
       </repositories> 
       <pluginRepositories> 
        <pluginRepository> 
         <id>central</id> 
        <name>Repository for your artifacts</name> 
         <url>https://url.to.your.nexus</url> 
         <releases> 
          <enabled>true</enabled> 
        </releases> 
         <snapshots> 
          <enabled>true</enabled> 
        </snapshots> 
        </pluginRepository> 
       </pluginRepositories> 
       <properties> 
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
       </properties> 
       <activation> 
        <activeByDefault>true</activeByDefault> 
       </activation> 
      </profile> 
     </profiles> 
     <activeProfiles> 
      <activeProfile>defaultprofile</activeProfile> 
     </activeProfiles> 
</settings> 

您必須覆蓋central(見上文) ,這樣Maven將不會連接到默認的centralrepo1.maven.org)。

+0

我已經在Nexus中擁有此代理存儲庫。 –

+0

添加了settings.xml配置 – asgoth