You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Gustavo Valle <gv...@westpac.com.au> on 2006/05/17 08:44:02 UTC

Internal remote repository setup in Maven 2

Hello

I'm new to Maven 2 and I just needed some help setting up my environment. 
Basically I want to have an internal remote repository where maven can 
download all plugins and artifacts not found in my local repository and to 
use it also to upload my project artifact. Simple uh? Well, I haven't been 
able to make this setting to work... I've tried setting the 
<distributionManagement> tag in the pom and that works for the upload via 
the deploy goal and I've set the <repository> and <pluginRepository> 
elements also in the pom for the download but when I clean my local 
repository, I expect that maven should download everything it needs from 
the internal remote repository which doesn't happen! When I manually copy 
all contents of my internal remote repository into my local repository, 
then maven works hapilly. I just don't get it. I've also tried setting up 
a mirror of central in my settings.xml with no better luck. I'm about to 
giving up on maven 2! Please help. Am I doing something wrong?

Cheers,
Gustavo


Please consider our environment before printing this email.

WARNING - This email and any attachments may be confidential. If received in error, please delete and inform us by return email. Because emails and attachments may be interfered with, may contain computer viruses or other defects and may not be successfully replicated on other systems, you must be cautious. Westpac cannot guarantee that what you receive is what we sent. If you have any doubts about the authenticity of an email by Westpac, please contact us immediately.

It is also important to check for viruses and defects before opening or using attachments. Westpac's liability is limited to resupplying any affected attachments.

This email and its attachments are not intended to constitute any form of financial advice or recommendation of, or an offer to buy or offer to sell, any security or other financial product. We recommend that you seek your own independent legal or financial advice before proceeding with any investment decision.

Westpac Institutional Bank is a division of Westpac Banking Corporation, a company registered in New South Wales in Australia under the Corporations Act 2001 (Cth). Westpac is authorised and regulated in the United Kingdom by the Financial Services Authority and is registered at Cardiff in the United Kingdom as Branch No. BR 106. Westpac operates in the United States of America as a federally chartered branch, regulated by the Office of the Comptroller of the Currency.

Westpac Banking Corporation ABN 33 007 457 141.

Re: Internal remote repository setup in Maven 2

Posted by Wayne Fay <wa...@gmail.com>.
Brad hit the nail on the head.

You are looking for Maven-Proxy. Search the Maven User list for help
setting it up -- there are lots of posts about it if you just search.

PS- "I'm about to give up" is really not conducive to receiving help
on this list. If anything, it makes me think "no need to respond to
*that* one, just let him go"...

Wayne

On 5/18/06, Brad Davis <bd...@saintandreas.org> wrote:
> Gustavo Valle wrote:
>
> >  <repositories>
> >    <repository>
> >      <id>central</id>
> >      <url>http://localhost:8080/maven</url>
> >    </repository>
> >  </repositories>
> >
> >  <pluginRepositories>
> >    <pluginRepository>
> >      <id>central</id>
> >      <url>http://localhost:8080/maven</url>
> >    </pluginRepository>
> >  </pluginRepositories>
> >
> >
> I believe by doing this you are overriding the default location for the
> central repository, and forcing maven to look for everything on
> localhost.  This won't work because it will fail to find its plugins
> there unless youve primed it already.
>
> What you want, from what you've described is a web app that will act as
> a caching Maven repository.  Maven won't do this itself.  If you
> override the central repository then the override location(s) are the
> only places maven will look for artifacts.
>
> The solution is Maven Proxy from codehaus.  When you request an artifact
> from Maven Proxy, it looks at a local (to it) repository and serves it
> from there, or if it can't, goes to an actual remote repository to fetch
> it.  Sadly, the site is down currently, and likely till the end of the
> week.  The google cache of the main page is here:
> http://66.102.7.104/search?q=cache:zfDNHXmX7sIJ:maven-proxy.codehaus.org/+maven+proxy+site:codehaus.org&hl=en&lr=&client=firefox-a&strip=1
>
> Personally I recommend using an installed copy of Maven Proxy as a
> mirror for central (specified either in your POM or your settings.xml)
> and using a seperate internal repository for internally developed projects.
>
> Brad
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

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


Re: Internal remote repository setup in Maven 2

Posted by Gustavo Valle <gv...@westpac.com.au>.
I agree that what I need is Maven Proxy, so I can serve the plugins and 
artifacts internally and at the same time, get the ones I don't have from 
the internet. But suppose I'm not connected to the internet, or if the 
policy is to control what artifacts exactly developers get to their local 
repositories. The settings I've described are outlined and explained in 
the (latest) book Better Builds with Maven (M2) 
(http://www.mergere.com/m2book_download.jsp) where the authors (Vincent 
Massol et.al) recommend overriding central in order to implement an 
internal remote repository. As strange as it may sound, at this stage it 
would be perfectly normal for Maven to fail if I don't have the artifact 
or plugin requested in my internal remote repository.
Perhaps the issue I'm pointing is that Maven should allow this scenario 
(and I'm sure it does!), the issue is not the fact that I can rely 
permanently on central and my local repository.
The other thing to consider in the example presented is that the plugin in 
question is just 'clean' (mickey mouse goal!). 

This won't work because it will fail to find its plugins 
there unless youve primed it already

The truth is that when I move all the contents of my intended internal 
remote repository back to my local repository, Maven runs fine. This means 
that for everything Maven needs for a clean is already downloaded.
The comment I made literally: I'm about to give up on maven! was because 
of the frustration because of the lack of M2 documentation. I'm a fan of 
Maven, don't get me wrong, and in my organisation, I've been a good 
promoter and evangelist. Some people suggested the upgrade and they looked 
to me in order to see if it was feasible. We had to stick to M1, even the 
documentation site of M1 is better organised and gets most of my answers 
faster than M2. Honestly, I don't like this mini-guides business, some of 
the links promise answers to interesting things but I get disappointed 
when I click on them, in many cases there was only a paragraph of basic 
stuff.

Cheers,
Gustavo




Brad Davis <bd...@saintandreas.org> 
18/05/2006 17:42
Please respond to
"Maven Users List" <us...@maven.apache.org>


To
Maven Users List <us...@maven.apache.org>
cc

Subject
Re: Internal remote repository setup in Maven 2






Gustavo Valle wrote:

>  <repositories>
>    <repository>
>      <id>central</id>
>      <url>http://localhost:8080/maven</url>
>    </repository>
>  </repositories>
> 
>  <pluginRepositories>
>    <pluginRepository>
>      <id>central</id>
>      <url>http://localhost:8080/maven</url>
>    </pluginRepository>
>  </pluginRepositories>
> 
>
I believe by doing this you are overriding the default location for the 
central repository, and forcing maven to look for everything on 
localhost.  This won't work because it will fail to find its plugins 
there unless youve primed it already. 

What you want, from what you've described is a web app that will act as 
a caching Maven repository.  Maven won't do this itself.  If you 
override the central repository then the override location(s) are the 
only places maven will look for artifacts. 

The solution is Maven Proxy from codehaus.  When you request an artifact 
from Maven Proxy, it looks at a local (to it) repository and serves it 
from there, or if it can't, goes to an actual remote repository to fetch 
it.  Sadly, the site is down currently, and likely till the end of the 
week.  The google cache of the main page is here: 
http://66.102.7.104/search?q=cache:zfDNHXmX7sIJ:maven-proxy.codehaus.org/+maven+proxy+site:codehaus.org&hl=en&lr=&client=firefox-a&strip=1


Personally I recommend using an installed copy of Maven Proxy as a 
mirror for central (specified either in your POM or your settings.xml) 
and using a seperate internal repository for internally developed 
projects.

Brad

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




Please consider our environment before printing this email.

WARNING - This email and any attachments may be confidential. If received in error, please delete and inform us by return email. Because emails and attachments may be interfered with, may contain computer viruses or other defects and may not be successfully replicated on other systems, you must be cautious. Westpac cannot guarantee that what you receive is what we sent. If you have any doubts about the authenticity of an email by Westpac, please contact us immediately.

It is also important to check for viruses and defects before opening or using attachments. Westpac's liability is limited to resupplying any affected attachments.

This email and its attachments are not intended to constitute any form of financial advice or recommendation of, or an offer to buy or offer to sell, any security or other financial product. We recommend that you seek your own independent legal or financial advice before proceeding with any investment decision.

Westpac Institutional Bank is a division of Westpac Banking Corporation, a company registered in New South Wales in Australia under the Corporations Act 2001 (Cth). Westpac is authorised and regulated in the United Kingdom by the Financial Services Authority and is registered at Cardiff in the United Kingdom as Branch No. BR 106. Westpac operates in the United States of America as a federally chartered branch, regulated by the Office of the Comptroller of the Currency.

Westpac Banking Corporation ABN 33 007 457 141.

Re: Internal remote repository setup in Maven 2

Posted by Brad Davis <bd...@saintandreas.org>.
Gustavo Valle wrote:

>  <repositories>
>    <repository>
>      <id>central</id>
>      <url>http://localhost:8080/maven</url>
>    </repository>
>  </repositories>
> 
>  <pluginRepositories>
>    <pluginRepository>
>      <id>central</id>
>      <url>http://localhost:8080/maven</url>
>    </pluginRepository>
>  </pluginRepositories>
>  
>
I believe by doing this you are overriding the default location for the 
central repository, and forcing maven to look for everything on 
localhost.  This won't work because it will fail to find its plugins 
there unless youve primed it already. 

What you want, from what you've described is a web app that will act as 
a caching Maven repository.  Maven won't do this itself.  If you 
override the central repository then the override location(s) are the 
only places maven will look for artifacts. 

The solution is Maven Proxy from codehaus.  When you request an artifact 
from Maven Proxy, it looks at a local (to it) repository and serves it 
from there, or if it can't, goes to an actual remote repository to fetch 
it.  Sadly, the site is down currently, and likely till the end of the 
week.  The google cache of the main page is here:  
http://66.102.7.104/search?q=cache:zfDNHXmX7sIJ:maven-proxy.codehaus.org/+maven+proxy+site:codehaus.org&hl=en&lr=&client=firefox-a&strip=1

Personally I recommend using an installed copy of Maven Proxy as a 
mirror for central (specified either in your POM or your settings.xml) 
and using a seperate internal repository for internally developed projects.

Brad

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


Re: Internal remote repository setup in Maven 2

Posted by Gustavo Valle <gv...@westpac.com.au>.
Hello again,
this is the project pom I use for my project:

<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd">

        <parent>
                <groupId>au.com.company.telephony</groupId>
                <artifactId>maven-base</artifactId>
                <version>1.0.0</version>
        </parent>

        <modelVersion>4.0.0</modelVersion>
        <groupId>au.com.company.telephony</groupId>
        <artifactId>telephony-test</artifactId>
        <packaging>jar</packaging>
        <version>1.0-SNAPSHOT</version>
        <name>Telephony Artefact</name>
        <url>http://maven.apache.org</url>
 
</project>

And this is the parent pom, I'm trying to set the repositories here:

<project xmlns="http://maven.apache.org/POM/4.0.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <name>Maven Base Project</name>
  <groupId>au.com.company.telephony</groupId>
  <artifactId>maven-base</artifactId>
  <packaging>pom</packaging>
  <version>1.0.0</version>

  <distributionManagement>
    <repository>
      <id>telephony-repository</id>
 <url>file:///home/valleg/apps/apache-tomcat-5.5/webapps/ROOT/maven</url>
    </repository>
  </distributionManagement>

  <repositories>
    <repository>
      <id>central</id>
      <url>http://localhost:8080/maven</url>
    </repository>
  </repositories>
 
  <pluginRepositories>
    <pluginRepository>
      <id>central</id>
      <url>http://localhost:8080/maven</url>
    </pluginRepository>
  </pluginRepositories>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.12</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
 
</project>

I'm also working with the defaults, meaning that I have no settings.xml 
and my local repository is set to: /home/user/.m2/repository
I'm running Maven 2 in SuSE Linux 10 by the way (don't think it matters 
though!).

This is the output I get when I run mvn clean:

valleg@linux:~/projects/Telephony/telephony-test> mvn clean
[INFO] Scanning for projects...
[INFO] 
----------------------------------------------------------------------------
[INFO] Building Telephony Artefact
[INFO]    task-segment: [clean]
[INFO] 
----------------------------------------------------------------------------
[INFO] [clean:clean]
[INFO] Deleting directory 
/home/valleg/projects/Telephony/telephony-test/target
[INFO] Deleting directory 
/home/valleg/projects/Telephony/telephony-test/target/classes
[INFO] Deleting directory 
/home/valleg/projects/Telephony/telephony-test/target/test-classes
[INFO] 
----------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] 
----------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Thu May 18 15:48:50 EST 2006
[INFO] Final Memory: 1M/3M
[INFO] 
----------------------------------------------------------------------------

And this is the output when I run mvn clean after I delete the contents of 
my local repository:

valleg@linux:~/projects/Telephony/telephony-test> mvn clean
[INFO] Scanning for projects...
[INFO] 
----------------------------------------------------------------------------
[INFO] Building Telephony Artefact
[INFO]    task-segment: [clean]
[INFO] 
----------------------------------------------------------------------------
[INFO] artifact org.apache.maven.plugins:maven-clean-plugin: checking for 
updates from central
[INFO] 
----------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] 
----------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-clean-plugin' does not 
exist or no valid version could be found
[INFO] 
----------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] 
----------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Thu May 18 15:50:23 EST 2006
[INFO] Final Memory: 1M/2M
[INFO] 
----------------------------------------------------------------------------

I would expect that Maven would download all the required artifacts again, 
but apparently it doesn't.
The only thing that gets created in my local repository is this file:

/home/user/.m2/repository/org/apache/maven/plugins/maven-clean-plugin/maven-metadata-central.xml

The error appears for every goal I try. Also tried setting a mirror in my 
settings.xml but it didn't work either.
What is it that I'm doing wrong? Please help me...
Could you possibly try it in your environment and tell me if this settings 
work? Thanks.

Cheers,
Gustavo




"jerome lacoste" <je...@gmail.com> 
17/05/2006 16:58
Please respond to
"Maven Users List" <us...@maven.apache.org>


To
"Maven Users List" <us...@maven.apache.org>
cc

Subject
Re: Internal remote repository setup in Maven 2






On 5/17/06, Gustavo Valle <gv...@westpac.com.au> wrote:
> Hello
>
> I'm new to Maven 2 and I just needed some help setting up my 
environment.
> Basically I want to have an internal remote repository where maven can
> download all plugins and artifacts not found in my local repository and 
to
> use it also to upload my project artifact. Simple uh? Well, I haven't 
been
> able to make this setting to work... I've tried setting the
> <distributionManagement> tag in the pom and that works for the upload 
via
> the deploy goal and I've set the <repository> and <pluginRepository>
> elements also in the pom for the download but when I clean my local
> repository, I expect that maven should download everything it needs from
> the internal remote repository which doesn't happen! When I manually 
copy
> all contents of my internal remote repository into my local repository,
> then maven works hapilly. I just don't get it. I've also tried setting 
up
> a mirror of central in my settings.xml with no better luck.

when you use -X, do you see maven trying to download artifacts from
your internal remote repository?

If not, your POM config must be wrong. Did you define an <id> for your
repository?

http://maven.apache.org/guides/introduction/introduction-to-repositories.html

http://maven.apache.org/guides/mini/guide-multiple-repositories.html
http://maven.apache.org/ref/current/maven-model/maven.html#class_repository


> I'm about to giving up on maven 2!

Not sure if that will give you more answers...

> Please help. Am I doing something wrong?
>
> Cheers,
> Gustavo

J

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




Please consider our environment before printing this email.

WARNING - This email and any attachments may be confidential. If received in error, please delete and inform us by return email. Because emails and attachments may be interfered with, may contain computer viruses or other defects and may not be successfully replicated on other systems, you must be cautious. Westpac cannot guarantee that what you receive is what we sent. If you have any doubts about the authenticity of an email by Westpac, please contact us immediately.

It is also important to check for viruses and defects before opening or using attachments. Westpac's liability is limited to resupplying any affected attachments.

This email and its attachments are not intended to constitute any form of financial advice or recommendation of, or an offer to buy or offer to sell, any security or other financial product. We recommend that you seek your own independent legal or financial advice before proceeding with any investment decision.

Westpac Institutional Bank is a division of Westpac Banking Corporation, a company registered in New South Wales in Australia under the Corporations Act 2001 (Cth). Westpac is authorised and regulated in the United Kingdom by the Financial Services Authority and is registered at Cardiff in the United Kingdom as Branch No. BR 106. Westpac operates in the United States of America as a federally chartered branch, regulated by the Office of the Comptroller of the Currency.

Westpac Banking Corporation ABN 33 007 457 141.

Re: Internal remote repository setup in Maven 2

Posted by jerome lacoste <je...@gmail.com>.
On 5/17/06, Gustavo Valle <gv...@westpac.com.au> wrote:
> Hello
>
> I'm new to Maven 2 and I just needed some help setting up my environment.
> Basically I want to have an internal remote repository where maven can
> download all plugins and artifacts not found in my local repository and to
> use it also to upload my project artifact. Simple uh? Well, I haven't been
> able to make this setting to work... I've tried setting the
> <distributionManagement> tag in the pom and that works for the upload via
> the deploy goal and I've set the <repository> and <pluginRepository>
> elements also in the pom for the download but when I clean my local
> repository, I expect that maven should download everything it needs from
> the internal remote repository which doesn't happen! When I manually copy
> all contents of my internal remote repository into my local repository,
> then maven works hapilly. I just don't get it. I've also tried setting up
> a mirror of central in my settings.xml with no better luck.

when you use -X, do you see maven trying to download artifacts from
your internal remote repository?

If not, your POM config must be wrong. Did you define an <id> for your
repository?

http://maven.apache.org/guides/introduction/introduction-to-repositories.html
http://maven.apache.org/guides/mini/guide-multiple-repositories.html
http://maven.apache.org/ref/current/maven-model/maven.html#class_repository

> I'm about to giving up on maven 2!

Not sure if that will give you more answers...

> Please help. Am I doing something wrong?
>
> Cheers,
> Gustavo

J

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