You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Todd Thiessen <th...@nortel.com> on 2008/11/11 18:27:11 UTC

Using an internal central repository without changing settings.xml

I have been looking into this for a couple of days and can't find the
answer. I suspect it isn't possible but I think it will be best to ask
those who can tell me definitively.

I want to be able to define a project which only has access to an
internally defined repository. Note I said project not user.  Using the
settings.xml to define my interal repository as the mirror to external
ones I don't think is the right thing to do.  Doing this makes the
project unportable since all developers on the project would have to
share the same settings.xml file.  Bad mojo.

I have tried modifying my POM file such that it overrides the central
repo... like this:

  <repositories>
    <repository>
      <id>central</id>
      <url>http://myinteralrepo</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>central</id>
      <url>http://myinteralrepo</url>
    </pluginRepository>
  </pluginRepositories>

However, this does not seem to be sufficient.  Most dependencies are
coming from my local repo but not all and I can't figure out why some
are not.  Here is a snippet of maven output.

url = http://myinteralrepo
Downloading:
http://myinteralrepo/org/apache/maven/plugins/maven-resources-plugin/2.2
/maven-resources-plugin-2.2.pom
url = http://repo1.maven.org/maven2
Downloading:
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-plugins/1/m
aven-plugins-1.pom
3K downloaded
url = http://repo1.maven.org/maven2
Downloading:
http://repo1.maven.org/maven2/org/apache/maven/maven-parent/1/maven-pare
nt-1.pom
6K downloaded

What is special about the first artifact, maven-resources-pluggin-2.2,
such that it comes from my internal repo but the others come from maven
central?

The only way that I have been completely successful in ensuring that all
artifacts come from my internal repo is by making the appropriate
changes to my settings.xml file.  But as I have already mentioned, I
don't wish to do this.

Thoughts?


---
Todd Thiessen


RE: Using an internal central repository without changing settings.xml

Posted by "Vogelsang, Jeff" <je...@pqa.com>.
Hello,

We aren't using Eclipse, but we solved a similar problem by explicitly
disabling Central, and enabling our own local repository in the project
pom. Example below.

    <repositories>
        <!-- Override and disable super-pom Central repository -->
        <repository>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>central</id>
            <name>Maven Repository Switchboard</name>
            <url>http://repo1.maven.org/maven2</url>
        </repository>
        <!-- Our Artifactory -->
        <repository>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
            <id>our.artifactory</id>
            <name>Our Repository</name>
            <url>http://our/artifactory/repo/</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <!-- Override and disable super-pom Central repository -->
        <pluginRepository>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>central</id>
            <name>Maven Plugin Repository</name>
            <url>http://repo1.maven.org/maven2</url>
        </pluginRepository>
        <!-- Our Artifactory -->
        <pluginRepository>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
            <id>our.artifactory</id>
            <name>Our Artifactory</name>
            <url>http://our/artifactory/repo/</url>
        </pluginRepository>
    </pluginRepositories>

-----Original Message-----
From: Todd Thiessen [mailto:thiessen@nortel.com] 
Sent: Tuesday, November 11, 2008 12:27 PM
To: users@maven.apache.org
Subject: Using an internal central repository without changing
settings.xml

I have been looking into this for a couple of days and can't find the
answer. I suspect it isn't possible but I think it will be best to ask
those who can tell me definitively.

I want to be able to define a project which only has access to an
internally defined repository. Note I said project not user.  Using the
settings.xml to define my interal repository as the mirror to external
ones I don't think is the right thing to do.  Doing this makes the
project unportable since all developers on the project would have to
share the same settings.xml file.  Bad mojo.

I have tried modifying my POM file such that it overrides the central
repo... like this:

  <repositories>
    <repository>
      <id>central</id>
      <url>http://myinteralrepo</url>
    </repository>
  </repositories>
  <pluginRepositories>
    <pluginRepository>
      <id>central</id>
      <url>http://myinteralrepo</url>
    </pluginRepository>
  </pluginRepositories>

However, this does not seem to be sufficient.  Most dependencies are
coming from my local repo but not all and I can't figure out why some
are not.  Here is a snippet of maven output.

url = http://myinteralrepo
Downloading:
http://myinteralrepo/org/apache/maven/plugins/maven-resources-plugin/2.2
/maven-resources-plugin-2.2.pom
url = http://repo1.maven.org/maven2
Downloading:
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-plugins/1/m
aven-plugins-1.pom
3K downloaded
url = http://repo1.maven.org/maven2
Downloading:
http://repo1.maven.org/maven2/org/apache/maven/maven-parent/1/maven-pare
nt-1.pom
6K downloaded

What is special about the first artifact, maven-resources-pluggin-2.2,
such that it comes from my internal repo but the others come from maven
central?

The only way that I have been completely successful in ensuring that all
artifacts come from my internal repo is by making the appropriate
changes to my settings.xml file.  But as I have already mentioned, I
don't wish to do this.

Thoughts?


---
Todd Thiessen


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org