Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
403 views
in Technique[技术] by (71.8m points)

repository - How do you stop maven from trying to access http://repo.maven.apache.org?

The development machine cannot access the internet, and take about 60s to timeout. When I try to build, I see

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

However, I have the following in my 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>

It always tries to go to repo.maven first. I even tried to add to D:.m2settings.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>

based on http://maven.apache.org/guides/mini/guide-mirror-settings.html yet it continues to try repo.maven first. I'm using Apache Maven 3.0.4 (r1232337; 2012-01-17 03:44:56-0500)

I can't use -o because it still needs to access the local repo.dev.


Here is with 'effective-settings':

D:UserschloeProjectseamconfluence-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
epository</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] ------------------------------------------------------------------------
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

All pom files inherit from the maven super POM http://maven.apache.org/ref/3.0.4/maven-model-builder/super-pom.html which contains this entry:

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

Try setting this in your pom (with <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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...