You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by George Karabotsos <ka...@gmail.com> on 2015/09/04 16:27:19 UTC

Creating local repository

Hello all,

Let me start by admitting I am by no means a maven expert :).

Now I have a need to create a local file-based repository to be used by
maven when building my project.  I need this because I have no net
access from a set of VMs I and colleagues have to use .

I was thinking of the following:
1) connected to the net, normally proceed and download all necessary
artifacts
2) copy these jars with
          > cp -r Users/gkarabotsos/.m2/repository .
3) Add the following to my pom.xml
  <repositories>
    <repository>
      <id>localrepository</id>
      <url>file:///c:/repository/</url>
    </repository>
  </repositories>

I do know that it does not work--I am guessing my c:/repository
structure does not have the correct form.   

I have also seen, in the net, commands such as the following:

mvn install:install-file -Dfile=YOUR_JAR.jar -DgroupId=YOUR_GROUP_ID
-DartifactId=YOUR_ARTIFACT_ID -Dversion=YOUR_VERSION -Dpackaging=jar
-DlocalRepositoryPath=/var/www/html/mavenRepository

Is this the only correct way? I have yet to try it, primarily because I
have a few dozen artifacts and doing so will take me a long time.

 
Cheers,
George

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


Re: Creating local repository

Posted by Baptiste Mathus <bm...@batmat.net>.
Hi,

You don't share the "local repository", it should be seen and actually have
been called "cache". Search for tools called "Maven Repository Manager".
The famous ones out there are Archiva, Artifactory & Nexus (in alphabetical
order).

Cheers

2015-09-05 5:07 GMT+02:00 Niraj Chaudhary <ni...@gmail.com>:

> Hi George,
>
> We had tried this earlier in my company.
> The problem is you never know what is 'all' the artifacts.
> Challenges faced:
>
> 1.One developer adding a new third-party dependency required that the
> artifact should be present in all the local dev repos for proper
> compilation.
> 2.Repo grows in size. Sharing becomes difficult.
>
> Thanks,
> Niraj
>
> On Fri, Sep 4, 2015 at 8:51 PM, George Karabotsos <ka...@gmail.com>
> wrote:
>
> > Hi Gail,
> >
> > The problem is that the VM is not controlled by my organization--they
> > are controlled by a third party.  As such, they are not even within our
> > intranet.
> >
> > I do have access to the master VM which has access to the internet to
> > allow me to set it up.   So what you and Michael mention, to get all
> > artifacts first, then use the -o flag from offilne VMs, should do the
> > trick.
> >
> > Thank you so much!
> >
> > Cheers,
> > George
> >
> > On Fri, Sep 4, 2015, at 10:54 AM, Gail Stewart wrote:
> > > How are you going to get the libraries you need to this server if you
> > > have
> > > no net access?
> > >
> > > I'm not sure if this would work, but one way might be to run the maven
> on
> > > a
> > > system with internet access so it populates the local repository in
> > > $HOME/.m2
> > >
> > > Tar or zip that directory up and get it to your server.  Unzip it into
> > > your
> > > $HOME/.m2 or to a common location for several developers to use.  You
> can
> > > tell maven where to find the local repo if you aren't using the default
> > > $HOME/.m2 location.
> > >
> > > Then run maven in offline mode.
> > >
> > > This is not ideal - why doesn't the server have internet access?  Could
> > > it
> > > have access to a company managed server?  If so you could setup a nexus
> > > or
> > > artifactory enterprise server - that would have internet access, but
> > > could
> > > be controlled in a secure manner.
> > >
> > >
> > > On Fri, Sep 4, 2015 at 10:27 AM, George Karabotsos <ka...@gmail.com>
> > > wrote:
> > >
> > > > Hello all,
> > > >
> > > > Let me start by admitting I am by no means a maven expert :).
> > > >
> > > > Now I have a need to create a local file-based repository to be used
> by
> > > > maven when building my project.  I need this because I have no net
> > > > access from a set of VMs I and colleagues have to use .
> > > >
> > > > I was thinking of the following:
> > > > 1) connected to the net, normally proceed and download all necessary
> > > > artifacts
> > > > 2) copy these jars with
> > > >           > cp -r Users/gkarabotsos/.m2/repository .
> > > > 3) Add the following to my pom.xml
> > > >   <repositories>
> > > >     <repository>
> > > >       <id>localrepository</id>
> > > >       <url>file:///c:/repository/</url>
> > > >     </repository>
> > > >   </repositories>
> > > >
> > > > I do know that it does not work--I am guessing my c:/repository
> > > > structure does not have the correct form.
> > > >
> > > > I have also seen, in the net, commands such as the following:
> > > >
> > > > mvn install:install-file -Dfile=YOUR_JAR.jar -DgroupId=YOUR_GROUP_ID
> > > > -DartifactId=YOUR_ARTIFACT_ID -Dversion=YOUR_VERSION -Dpackaging=jar
> > > > -DlocalRepositoryPath=/var/www/html/mavenRepository
> > > >
> > > > Is this the only correct way? I have yet to try it, primarily
> because I
> > > > have a few dozen artifacts and doing so will take me a long time.
> > > >
> > > >
> > > > Cheers,
> > > > George
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: users-help@maven.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > >
> > > Gail Stewart
> > > Sr. Release Engineer
> > >
> > > AP & Payment Automation
> > > 125 Cambridgepark Drive
> > > Cambridge, MA 02140
> > > gail.stewart@mineraltree.com
> > > 617.299.3399 x148
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>



-- 
Baptiste <Batmat> MATHUS - http://batmat.net
Sauvez un arbre,
Mangez un castor !

Re: Creating local repository

Posted by Niraj Chaudhary <ni...@gmail.com>.
Hi George,

We had tried this earlier in my company.
The problem is you never know what is 'all' the artifacts.
Challenges faced:

1.One developer adding a new third-party dependency required that the
artifact should be present in all the local dev repos for proper
compilation.
2.Repo grows in size. Sharing becomes difficult.

Thanks,
Niraj

On Fri, Sep 4, 2015 at 8:51 PM, George Karabotsos <ka...@gmail.com> wrote:

> Hi Gail,
>
> The problem is that the VM is not controlled by my organization--they
> are controlled by a third party.  As such, they are not even within our
> intranet.
>
> I do have access to the master VM which has access to the internet to
> allow me to set it up.   So what you and Michael mention, to get all
> artifacts first, then use the -o flag from offilne VMs, should do the
> trick.
>
> Thank you so much!
>
> Cheers,
> George
>
> On Fri, Sep 4, 2015, at 10:54 AM, Gail Stewart wrote:
> > How are you going to get the libraries you need to this server if you
> > have
> > no net access?
> >
> > I'm not sure if this would work, but one way might be to run the maven on
> > a
> > system with internet access so it populates the local repository in
> > $HOME/.m2
> >
> > Tar or zip that directory up and get it to your server.  Unzip it into
> > your
> > $HOME/.m2 or to a common location for several developers to use.  You can
> > tell maven where to find the local repo if you aren't using the default
> > $HOME/.m2 location.
> >
> > Then run maven in offline mode.
> >
> > This is not ideal - why doesn't the server have internet access?  Could
> > it
> > have access to a company managed server?  If so you could setup a nexus
> > or
> > artifactory enterprise server - that would have internet access, but
> > could
> > be controlled in a secure manner.
> >
> >
> > On Fri, Sep 4, 2015 at 10:27 AM, George Karabotsos <ka...@gmail.com>
> > wrote:
> >
> > > Hello all,
> > >
> > > Let me start by admitting I am by no means a maven expert :).
> > >
> > > Now I have a need to create a local file-based repository to be used by
> > > maven when building my project.  I need this because I have no net
> > > access from a set of VMs I and colleagues have to use .
> > >
> > > I was thinking of the following:
> > > 1) connected to the net, normally proceed and download all necessary
> > > artifacts
> > > 2) copy these jars with
> > >           > cp -r Users/gkarabotsos/.m2/repository .
> > > 3) Add the following to my pom.xml
> > >   <repositories>
> > >     <repository>
> > >       <id>localrepository</id>
> > >       <url>file:///c:/repository/</url>
> > >     </repository>
> > >   </repositories>
> > >
> > > I do know that it does not work--I am guessing my c:/repository
> > > structure does not have the correct form.
> > >
> > > I have also seen, in the net, commands such as the following:
> > >
> > > mvn install:install-file -Dfile=YOUR_JAR.jar -DgroupId=YOUR_GROUP_ID
> > > -DartifactId=YOUR_ARTIFACT_ID -Dversion=YOUR_VERSION -Dpackaging=jar
> > > -DlocalRepositoryPath=/var/www/html/mavenRepository
> > >
> > > Is this the only correct way? I have yet to try it, primarily because I
> > > have a few dozen artifacts and doing so will take me a long time.
> > >
> > >
> > > Cheers,
> > > George
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> >
> >
> > --
> >
> > Gail Stewart
> > Sr. Release Engineer
> >
> > AP & Payment Automation
> > 125 Cambridgepark Drive
> > Cambridge, MA 02140
> > gail.stewart@mineraltree.com
> > 617.299.3399  x148
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: Creating local repository

Posted by George Karabotsos <ka...@gmail.com>.
Hi Gail,

The problem is that the VM is not controlled by my organization--they
are controlled by a third party.  As such, they are not even within our
intranet.

I do have access to the master VM which has access to the internet to
allow me to set it up.   So what you and Michael mention, to get all
artifacts first, then use the -o flag from offilne VMs, should do the
trick.

Thank you so much!

Cheers,
George

On Fri, Sep 4, 2015, at 10:54 AM, Gail Stewart wrote:
> How are you going to get the libraries you need to this server if you
> have
> no net access?
> 
> I'm not sure if this would work, but one way might be to run the maven on
> a
> system with internet access so it populates the local repository in
> $HOME/.m2
> 
> Tar or zip that directory up and get it to your server.  Unzip it into
> your
> $HOME/.m2 or to a common location for several developers to use.  You can
> tell maven where to find the local repo if you aren't using the default
> $HOME/.m2 location.
> 
> Then run maven in offline mode.
> 
> This is not ideal - why doesn't the server have internet access?  Could
> it
> have access to a company managed server?  If so you could setup a nexus
> or
> artifactory enterprise server - that would have internet access, but
> could
> be controlled in a secure manner.
> 
> 
> On Fri, Sep 4, 2015 at 10:27 AM, George Karabotsos <ka...@gmail.com>
> wrote:
> 
> > Hello all,
> >
> > Let me start by admitting I am by no means a maven expert :).
> >
> > Now I have a need to create a local file-based repository to be used by
> > maven when building my project.  I need this because I have no net
> > access from a set of VMs I and colleagues have to use .
> >
> > I was thinking of the following:
> > 1) connected to the net, normally proceed and download all necessary
> > artifacts
> > 2) copy these jars with
> >           > cp -r Users/gkarabotsos/.m2/repository .
> > 3) Add the following to my pom.xml
> >   <repositories>
> >     <repository>
> >       <id>localrepository</id>
> >       <url>file:///c:/repository/</url>
> >     </repository>
> >   </repositories>
> >
> > I do know that it does not work--I am guessing my c:/repository
> > structure does not have the correct form.
> >
> > I have also seen, in the net, commands such as the following:
> >
> > mvn install:install-file -Dfile=YOUR_JAR.jar -DgroupId=YOUR_GROUP_ID
> > -DartifactId=YOUR_ARTIFACT_ID -Dversion=YOUR_VERSION -Dpackaging=jar
> > -DlocalRepositoryPath=/var/www/html/mavenRepository
> >
> > Is this the only correct way? I have yet to try it, primarily because I
> > have a few dozen artifacts and doing so will take me a long time.
> >
> >
> > Cheers,
> > George
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
> 
> 
> -- 
> 
> Gail Stewart
> Sr. Release Engineer
> 
> AP & Payment Automation
> 125 Cambridgepark Drive
> Cambridge, MA 02140
> gail.stewart@mineraltree.com
> 617.299.3399  x148

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


Re: Creating local repository

Posted by Gail Stewart <ga...@mineraltree.com>.
How are you going to get the libraries you need to this server if you have
no net access?

I'm not sure if this would work, but one way might be to run the maven on a
system with internet access so it populates the local repository in
$HOME/.m2

Tar or zip that directory up and get it to your server.  Unzip it into your
$HOME/.m2 or to a common location for several developers to use.  You can
tell maven where to find the local repo if you aren't using the default
$HOME/.m2 location.

Then run maven in offline mode.

This is not ideal - why doesn't the server have internet access?  Could it
have access to a company managed server?  If so you could setup a nexus or
artifactory enterprise server - that would have internet access, but could
be controlled in a secure manner.


On Fri, Sep 4, 2015 at 10:27 AM, George Karabotsos <ka...@gmail.com>
wrote:

> Hello all,
>
> Let me start by admitting I am by no means a maven expert :).
>
> Now I have a need to create a local file-based repository to be used by
> maven when building my project.  I need this because I have no net
> access from a set of VMs I and colleagues have to use .
>
> I was thinking of the following:
> 1) connected to the net, normally proceed and download all necessary
> artifacts
> 2) copy these jars with
>           > cp -r Users/gkarabotsos/.m2/repository .
> 3) Add the following to my pom.xml
>   <repositories>
>     <repository>
>       <id>localrepository</id>
>       <url>file:///c:/repository/</url>
>     </repository>
>   </repositories>
>
> I do know that it does not work--I am guessing my c:/repository
> structure does not have the correct form.
>
> I have also seen, in the net, commands such as the following:
>
> mvn install:install-file -Dfile=YOUR_JAR.jar -DgroupId=YOUR_GROUP_ID
> -DartifactId=YOUR_ARTIFACT_ID -Dversion=YOUR_VERSION -Dpackaging=jar
> -DlocalRepositoryPath=/var/www/html/mavenRepository
>
> Is this the only correct way? I have yet to try it, primarily because I
> have a few dozen artifacts and doing so will take me a long time.
>
>
> Cheers,
> George
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 

Gail Stewart
Sr. Release Engineer

AP & Payment Automation
125 Cambridgepark Drive
Cambridge, MA 02140
gail.stewart@mineraltree.com
617.299.3399  x148

Re: Creating local repository

Posted by George Karabotsos <ka...@gmail.com>.
Thank you Michael, I will give it a try and let you know how it goes.
Cheers,
George


On Fri, Sep 4, 2015, at 10:54 AM, Michael.CTR.Tarullo@faa.gov wrote:
> You don't really need to point to a local repository.  By default Maven
> will use C:\Users\<username>\.m2\respository as the local repo.  (i.e.
> for a Windows host).
> 
> If you want to specify a different location for the local repo you can
> use this in your settings.xml:
> <localRepository>
>     C:\<anyplace>......
> </localRepository>
> 
> Finally, to populate your local repo for the first time (i.e. when you
> ARE connected to the net), you can execute the Maven goal
> archetype:create to build a "hello world" app.  As long a you start with
> an empty local repository, wherever that happens to be i.e. the default
> location or somewhere else as per your settings.xml file, then Maven will
> attempt to get plugins and artifacts from the local repo first but since
> it is empty it will go to the default remote repo to get these and
> populate the local repo.  As long as you can access the location of the
> local repo from your VM's there is no need to copy anything!
> 
> Just one reminder, when you run Maven with the archetype:create goal DO
> NOT use the -o option!!!  After that, when you want to use the local repo
> only USE the -o option.
> 
> One last thought.  Using Maven in offline only mode may present you with
> some problems down the road, depending on what "external" artifacts your
> application uses.  If you only populate the local repo once then you will
> not be using updated artifacts as they become available.  If you are not
> using any "external" artifacts (e.g. XML parsers, log file libraries,
> etc.) in your app, this should not be a problem.
> 
> Other on the mailing list feel free to correct me if  I've given George
> any incorrect info.
> 
> Good luck!  And happy building.
> 
> Michael Tarullo
> Contractor (Engility Corp)
> Enterprise Architect
> NSRR System Administrator
> FAA WJH Technical Center
> (609)485-5294
> 
> 
> -----Original Message-----
> From: George Karabotsos [mailto:karabot@gmail.com] 
> Sent: Friday, September 04, 2015 10:27 AM
> To: users@maven.apache.org
> Subject: Creating local repository
> 
> Hello all,
> 
> Let me start by admitting I am by no means a maven expert :).
> 
> Now I have a need to create a local file-based repository to be used by
> maven when building my project.  I need this because I have no net access
> from a set of VMs I and colleagues have to use .
> 
> I was thinking of the following:
> 1) connected to the net, normally proceed and download all necessary
> artifacts
> 2) copy these jars with
>           > cp -r Users/gkarabotsos/.m2/repository .
> 3) Add the following to my pom.xml
>   <repositories>
>     <repository>
>       <id>localrepository</id>
>       <url>file:///c:/repository/</url>
>     </repository>
>   </repositories>
> 
> I do know that it does not work--I am guessing my c:/repository
> structure does not have the correct form.   
> 
> I have also seen, in the net, commands such as the following:
> 
> mvn install:install-file -Dfile=YOUR_JAR.jar -DgroupId=YOUR_GROUP_ID
> -DartifactId=YOUR_ARTIFACT_ID -Dversion=YOUR_VERSION -Dpackaging=jar
> -DlocalRepositoryPath=/var/www/html/mavenRepository
> 
> Is this the only correct way? I have yet to try it, primarily because I
> have a few dozen artifacts and doing so will take me a long time.
> 
>  
> Cheers,
> George
> 
> ---------------------------------------------------------------------
> 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
> 

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


RE: Creating local repository

Posted by Mi...@faa.gov.
You don't really need to point to a local repository.  By default Maven will use C:\Users\<username>\.m2\respository as the local repo.  (i.e. for a Windows host).

If you want to specify a different location for the local repo you can use this in your settings.xml:
<localRepository>
    C:\<anyplace>......
</localRepository>

Finally, to populate your local repo for the first time (i.e. when you ARE connected to the net), you can execute the Maven goal archetype:create to build a "hello world" app.  As long a you start with an empty local repository, wherever that happens to be i.e. the default location or somewhere else as per your settings.xml file, then Maven will attempt to get plugins and artifacts from the local repo first but since it is empty it will go to the default remote repo to get these and populate the local repo.  As long as you can access the location of the local repo from your VM's there is no need to copy anything!

Just one reminder, when you run Maven with the archetype:create goal DO NOT use the -o option!!!  After that, when you want to use the local repo only USE the -o option.

One last thought.  Using Maven in offline only mode may present you with some problems down the road, depending on what "external" artifacts your application uses.  If you only populate the local repo once then you will not be using updated artifacts as they become available.  If you are not using any "external" artifacts (e.g. XML parsers, log file libraries, etc.) in your app, this should not be a problem.

Other on the mailing list feel free to correct me if  I've given George any incorrect info.

Good luck!  And happy building.

Michael Tarullo
Contractor (Engility Corp)
Enterprise Architect
NSRR System Administrator
FAA WJH Technical Center
(609)485-5294


-----Original Message-----
From: George Karabotsos [mailto:karabot@gmail.com] 
Sent: Friday, September 04, 2015 10:27 AM
To: users@maven.apache.org
Subject: Creating local repository

Hello all,

Let me start by admitting I am by no means a maven expert :).

Now I have a need to create a local file-based repository to be used by maven when building my project.  I need this because I have no net access from a set of VMs I and colleagues have to use .

I was thinking of the following:
1) connected to the net, normally proceed and download all necessary artifacts
2) copy these jars with
          > cp -r Users/gkarabotsos/.m2/repository .
3) Add the following to my pom.xml
  <repositories>
    <repository>
      <id>localrepository</id>
      <url>file:///c:/repository/</url>
    </repository>
  </repositories>

I do know that it does not work--I am guessing my c:/repository
structure does not have the correct form.   

I have also seen, in the net, commands such as the following:

mvn install:install-file -Dfile=YOUR_JAR.jar -DgroupId=YOUR_GROUP_ID -DartifactId=YOUR_ARTIFACT_ID -Dversion=YOUR_VERSION -Dpackaging=jar -DlocalRepositoryPath=/var/www/html/mavenRepository

Is this the only correct way? I have yet to try it, primarily because I have a few dozen artifacts and doing so will take me a long time.

 
Cheers,
George

---------------------------------------------------------------------
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: Creating local repository

Posted by Mi...@faa.gov.
George,

Nor am I a Maven expert, by any stretch of the imagination!

But from experience, when you want to work with Maven such that is uses only the local repository you must use the -o (the offline only) option when executing your builds.

I will look at your other questions because I think there are some other things you can do as alternatives.

Mike

Michael Tarullo
Contractor (Engility Corp)
Enterprise Architect
NSRR System Administrator
FAA WJH Technical Center
(609)485-5294

-----Original Message-----
From: George Karabotsos [mailto:karabot@gmail.com] 
Sent: Friday, September 04, 2015 10:27 AM
To: users@maven.apache.org
Subject: Creating local repository

Hello all,

Let me start by admitting I am by no means a maven expert :).

Now I have a need to create a local file-based repository to be used by maven when building my project.  I need this because I have no net access from a set of VMs I and colleagues have to use .

I was thinking of the following:
1) connected to the net, normally proceed and download all necessary artifacts
2) copy these jars with
          > cp -r Users/gkarabotsos/.m2/repository .
3) Add the following to my pom.xml
  <repositories>
    <repository>
      <id>localrepository</id>
      <url>file:///c:/repository/</url>
    </repository>
  </repositories>

I do know that it does not work--I am guessing my c:/repository
structure does not have the correct form.   

I have also seen, in the net, commands such as the following:

mvn install:install-file -Dfile=YOUR_JAR.jar -DgroupId=YOUR_GROUP_ID -DartifactId=YOUR_ARTIFACT_ID -Dversion=YOUR_VERSION -Dpackaging=jar -DlocalRepositoryPath=/var/www/html/mavenRepository

Is this the only correct way? I have yet to try it, primarily because I have a few dozen artifacts and doing so will take me a long time.

 
Cheers,
George

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