3

Nexus を使用している場合、Spring Roo (1.2.3.RELEASE) プロジェクトをコンパイルできません。

mvn は roo.annotations:jar が見つからないと言います

[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]

ただし、この jar は既にローカルの 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をプロキシ リポジトリとして追加しても役に立ちません)

更新: 写真を追加します。左側に spring-roo-repository を追加しても役に立ちません。以下の2つの長い回答も役に立ちません。

ネクサス公開

4

2 に答える 2

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>

構成とは別に、ローカル リポジトリを削除して、ビルドを再試行する必要があります。Maven Central などのインターネットにアクセスできるように、Nexus を正しく構成しましたか?

于 2013-01-05T11:26:04.377 に答える
1

Nexus インストールへの管理者アクセス権があるかどうかはわかりませんが、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>

centralMaven がデフォルトcentral( ) に接続しないように、オーバーライドする必要があります(上記を参照repo1.maven.org)。

于 2013-01-05T11:28:12.920 に答える