49

開発マシンがインターネットにアクセスできず、タイムアウトまでに約 60 秒かかります。ビルドしようとすると、

Downloading: http://repo.maven.apache.org/maven2/com/google/gsa-connector/2.8.0/gsa-connector-2.8.0.pom

ただし、POMには次のものがあります。

    <repository>
      <id>bb-nexus</id>
      <url>http://repo.dev.bloomberg.com/content/groups/public</url>
      <releases><enabled>true</enabled></releases>
      <snapshots><enabled>true</enabled></snapshots>
    </repository>
    <repository>
      <id>nexus-3rdparty</id>
      <url>http://repo.dev.bloomberg.com/content/repositories/thirdparty/</url>
      <releases><enabled>true</enabled></releases>
      <snapshots><enabled>true</enabled></snapshots>
    </repository>

常に最初に repo.maven に移動しようとします。D:\.m2\settings.xml に追加しようとしました

<settings>
  <mirrors>
    <mirror>
      <!--This sends everything else to /public -->
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
      <url>http://repo.dev.bloomberg.com/content/groups/public</url>
    </mirror>
  </mirrors>

http://maven.apache.org/guides/mini/guide-mirror-settings.htmlに基づいていますが、最初に repo.maven を試し続けています。Apache Maven 3.0.4 を使用しています (r1232337; 2012-01-17 03:44:56-0500)

-o はまだローカルの repo.dev にアクセスする必要があるため、使用できません。


ここに「有効な設定」があります:

D:\Users\chloe\Projects\team\confluence-plugin>mvn help:effective-settings
[INFO] Scanning for projects...
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-install-plugin/maven-metadata.xml
[WARNING] Could not transfer metadata org.apache.maven.plugins:maven-install-plugin/maven-metadata.xml from/to central (
http://repo.maven.apache.org/maven2): Connection to http://repo.maven.apache.org refused
...
[INFO]
[INFO] --- maven-help-plugin:2.1.1:effective-settings (default-cli) @ bb-confluence-plugin ---
[INFO]
Effective user-specific configuration settings:

<?xml version="1.0" encoding="UTF-8"?>
...
<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLoca
tion="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
  <localRepository xmlns="http://maven.apache.org/SETTINGS/1.1.0">d:\.m2\repository</localRepository>
  <pluginGroups xmlns="http://maven.apache.org/SETTINGS/1.1.0">
    <pluginGroup>org.apache.maven.plugins</pluginGroup>
    <pluginGroup>org.codehaus.mojo</pluginGroup>
  </pluginGroups>
</settings>

[INFO] ------------------------------------------------------------------------
4

3 に答える 3

53

すべての pom ファイルは、次のエントリを含むMaven スーパー POM http://maven.apache.org/ref/3.0.4/maven-model-builder/super-pom.htmlから継承します。

<repositories>
    <repository>
        <id>central</id>
        <name>Central Repository</name>
        <url>http://repo.maven.apache.org/maven2</url>
        <layout>default</layout>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>

これをpomで設定してみてください(を使用<id>central</id>):

<repositories>
    <repository>
        <id>central</id>
        <url>http://repo.dev.bloomberg.com/content/groups/public</url>
        <releases>
            <enabled>false</enabled>
        </releases>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>central</id>
        <url>http://repo.dev.bloomberg.com/content/groups/public</url>
        <releases>
            <enabled>false</enabled>
        </releases>
    </pluginRepository>
</pluginRepositories>
于 2012-10-09T21:26:33.647 に答える
29

中央リポジトリのオーバーライド

使い方:

ほとんどの組織は、1 つまたは複数の共有リポジトリをセットアップする必要があります。これは、誰もが中央の Maven リポジトリから展開したり、単純にダウンロードしたりできるわけではないためです。内部リポジトリとして。

プロジェクトでこのリポジトリを使用する場合、ミラーとして使用するか、中央リポジトリをオーバーライドするかの 2 つの選択肢があります。中央リポジトリのコピーのみを意図している場合、および開発者が設定でこれを構成することが許容される場合は、ミラーとして使用します。または、この場合のように、より詳細な制御のために中央リポジトリへのアクセスを防止したい場合、各ユーザーの設定ではなくプロジェクト レベルからリポジトリを構成したい場合、または同じリポジトリに独自のアーティファクトを含める場合は、中央リポジトリをオーバーライドする必要があります。リポジトリ。

また、この時点で、maven の依存関係によって実行される解決プロセスを念頭に置くことが非常に重要です。これには、リポジトリの 2 つの主要なブロック設定があります。

  1. 品位に関連するものは、当社内でリストされます。
  2. ノード内に追加されるか、ライフサイクル中に使用されるプラグインに関連しています。

ソリューション:

オブジェクト指向フレームワークとして、Maven にはすべての POM が暗黙の親である Super POM を持っています。その定義の下に、依存関係とプラグインの両方の最初のリゾルバー リポジトリ構成を配置します。

<repositories>
    <repository>
      <id>central</id>
      <name>Maven Repository Switchboard</name>
      <layout>default</layout>
      <url>http://repo1.maven.org/maven2</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>central</id>
      <name>Maven Plugin Repository</name>
      <url>http://repo1.maven.org/maven2</url>
      <layout>default</layout>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <releases>
        <updatePolicy>never</updatePolicy>
      </releases>
    </pluginRepository>
  </pluginRepositories> 

中央リポジトリを内部リポジトリでオーバーライドするには、設定ファイルや POM で識別子 central ( <id>central</id>) を使用するリポジトリを定義する必要があります。通常、これは通常のリポジトリとプラグイン リポジトリの両方として定義して、すべてのアクセスが一貫していることを確認する必要があります。例えば:

<repositories>
    <repository>
      <id>central</id>
      <name>Maven Repository Switchboard</name>
      <layout>default</layout>
      <url>http://repo.dev.bloomberg.com/content/groups/public</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>central</id>
      <name>Maven Plugin Repository</name>
      <url>http://repo.dev.bloomberg.com/content/groups/public</url>
      <layout>default</layout>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
      <releases>
        <updatePolicy>never</updatePolicy>
      </releases>
    </pluginRepository>
  </pluginRepositories> 

関連リンク: Coderwall - Maven による中央リポジトリへのアクセスの停止

于 2014-02-27T22:25:41.700 に答える
0

Reporting/plugins ブロックで次のように設定してみてください

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-project-info-reports-plugin</artifactId>
        <version>2.9</version>
        <configuration>
            <dependencyLocationsEnabled>false</dependencyLocationsEnabled>
        </configuration>
    </plugin>
于 2016-08-22T17:44:38.587 に答える