You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by John Willemin <jj...@buttdynoracing.com> on 2009/02/12 17:24:06 UTC

Maven, offline use and source control

Alright - I am pretty new to Maven and have some newbie questions. It's a 
little wierd for me coming from seven years of Ant. I have read through 
the definitive guide (mostly skimming) and set up a simple web application 
using archetype:create. I like that it tries to enforce directory 
structure as well as build lifecycle. I have added a few dependencies to 
the application and I'm trying to figure out how folks use Maven in a 
mostly-offline environment.

We have a situation where the developers all have laptops. At work, these 
are not hooked up to the Internet. If we want to check stuff into 
Subversion, we need to go home.

In a Maven project, is it assumed that the jars are not going to be 
checked in with the source code and that they'll just be auto-snagged over 
the Internet during a build?

If you want to move your Maven project to a different network, where you 
won't have internet access, do you copy your local .m2 directory as well 
as the project, or do you set up a new central repository on that network?

That's a starting point until I get my head better wrapped around this :)

Thanks,
John

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


Re: Maven, offline use and source control

Posted by John Willemin <jj...@buttdynoracing.com>.
> Get Nexus <http://nexus.sonatype.org/>  for your Maven repository.
> It's free, and is a true Maven repository. Originally, I was using my
> own repository using SCP, but a true Maven repository has features
> that Maven clients can't emulate alone.

So this is something that we would use in place of just pointing at the 
default central repository, right? It looks like from reading their 
website that we could set up an "Internet" nexus, and an internal-network 
Nexus,and since it's just using the filesystem, we could store the 
contents of the Nexus database in version control every so often. Then 
when we wanted to push to the internal network we would burn a CD of the 
Nexus files, and build as usual, and Maven would pull the files out of 
that repository and put them into our respective home directories on the 
internal network. Does that sound remotely correct?

> The big difference between Ant and Maven is that Ant describes how you
> do a build and Maven  describes the project and its dependencies. In
> Ant, you need to figure out your dependencies on their own and make
> sure they are locally available.
>
> Maven is suppose to work out its dependency matrix. For example, you
> may know you need foo.jar, and that foo.jar depends upon bar.jar which
> depends upon fubar.jar and barfoo.jar. In Ant, you would have to have
> all of these available before you do a build.
>
> In Maven, you merely state that you need version 1.2 of foo.jar, and
> Maven understands that you also need the other jars and what versions.

I have gotten this far - and this part is quite handy. For instance, 
Hibernate requries all those wierd libraries like cglib, antlr, etc and 
Maven just figured out that I needed them with no prompting on my part.

> Unlike Ant, Maven assumes you have some sort of Maven Repository, and
> that it's normally network accessible. In Maven, you don't check in
> JARs and other binaries .You version them and store them in a Maven
> repository for fetching. They are downloaded when you need them. Yes,
> they might be cached in your ~/.m2 directory or maybe stored locally
> on a internal repository.
>
> In Maven you always need a repository. This could be your ~/.m2
> directory, so if you are not connected to the Internet, you could
> download all the Jars you might need into your ~/.m2 repository. I
> guess you could even create a Subversion repository for a
> ~/.m2/repository directory structure to allow people to check out the
> needed Jars and create an ~/.m2/repository directory. But normally,
> Maven assumes Internet connectivity of some sort when it needs
> something that isn't already cached.

So, how do people typically set up their Eclipse classpath? With a 
standard Ant project, you point the New Project wizard at a directory and 
it does a pretty good job figuring out where your jars are. Does this 
require some plugin for Eclipse, or do people just add the jars as 
"external jars" in the project properties?

thanks,
john

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


Re: Maven, offline use and source control

Posted by David Weintraub <qa...@gmail.com>.
Get Nexus <http://nexus.sonatype.org/>  for your Maven repository.
It's free, and is a true Maven repository. Originally, I was using my
own repository using SCP, but a true Maven repository has features
that Maven clients can't emulate alone.

The big difference between Ant and Maven is that Ant describes how you
do a build and Maven  describes the project and its dependencies. In
Ant, you need to figure out your dependencies on their own and make
sure they are locally available.

Maven is suppose to work out its dependency matrix. For example, you
may know you need foo.jar, and that foo.jar depends upon bar.jar which
depends upon fubar.jar and barfoo.jar. In Ant, you would have to have
all of these available before you do a build.

In Maven, you merely state that you need version 1.2 of foo.jar, and
Maven understands that you also need the other jars and what versions.

Unlike Ant, Maven assumes you have some sort of Maven Repository, and
that it's normally network accessible. In Maven, you don't check in
JARs and other binaries .You version them and store them in a Maven
repository for fetching. They are downloaded when you need them. Yes,
they might be cached in your ~/.m2 directory or maybe stored locally
on a internal repository.

In Maven you always need a repository. This could be your ~/.m2
directory, so if you are not connected to the Internet, you could
download all the Jars you might need into your ~/.m2 repository. I
guess you could even create a Subversion repository for a
~/.m2/repository directory structure to allow people to check out the
needed Jars and create an ~/.m2/repository directory. But normally,
Maven assumes Internet connectivity of some sort when it needs
something that isn't already cached.

On Thu, Feb 12, 2009 at 11:24 AM, John Willemin <jj...@buttdynoracing.com> wrote:
> Alright - I am pretty new to Maven and have some newbie questions. It's a
> little wierd for me coming from seven years of Ant. I have read through the
> definitive guide (mostly skimming) and set up a simple web application using
> archetype:create. I like that it tries to enforce directory structure as
> well as build lifecycle. I have added a few dependencies to the application
> and I'm trying to figure out how folks use Maven in a mostly-offline
> environment.
>
> We have a situation where the developers all have laptops. At work, these
> are not hooked up to the Internet. If we want to check stuff into
> Subversion, we need to go home.
>
> In a Maven project, is it assumed that the jars are not going to be checked
> in with the source code and that they'll just be auto-snagged over the
> Internet during a build?
>
> If you want to move your Maven project to a different network, where you
> won't have internet access, do you copy your local .m2 directory as well as
> the project, or do you set up a new central repository on that network?
>
> That's a starting point until I get my head better wrapped around this :)
>
> Thanks,
> John
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>



-- 
--
David Weintraub
qazwart@gmail.com

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