wood burning stoves 2.0*
The moose likes Ant, Maven and Other Build Tools and the fly likes Setting up new Maven Installation and Local Repository -- How best to to it? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Setting up new Maven Installation and Local Repository -- How best to to it?" Watch "Setting up new Maven Installation and Local Repository -- How best to to it?" New topic

Setting up new Maven Installation and Local Repository -- How best to to it?

Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1043
I've been tasked with setting up a brand new Maven repository for our development team.

Yikes, but I've never used Maven!!!

We use both Intellij and Eclipse on our team if that makes any difference.


I'm still waiting for our team's exact requirements, but I believe we would want a local repository since the code is proprietary.

So, would the best way to proceed be to install Jenkins for a local repository and then fiddle around with Maven builds until it ... works?

The Apache maven tutorial looks good, but it's also a bit cryptic, maybe like Maven itself? A quick question that jumps out looking at the Apache site -- if I'm using an IDE like Intellij, do I have to install Maven separately like the Apache tutorial or is Maven really built in to modern IDEs?

Once installed, I'm guessing I can just use Maven directly from Intelij or from Eclipse, right?

I saw a decent chapter in the "Well Grounded Java Developer" that discusses Maven installations.

Look forward to any suggestions on how best to get started.


- Mike
Jayesh A Lalwani

Joined: Jan 17, 2008
Posts: 2273

If you install maven, it automatically sets up a repository on the local machine. You don't need to do anything. It's basically unzip and go. Eclipse comes with a plugin called m2eclipse that let's you import maven projects into eclipse and run maven builds from inside eclipse. The installation is pretty simple too. Just use eclipse update

You should be setting up a repository in your local network that mirrors public repositories and also contains your own artifacts. We are using artifactory. The installation for artifactory is pretty simple too. Just download the installer and execute it. It sets up everything for you

Jenkins is a CI server, not a maven repo. I haven't installed it myself, but someone else installed Hudson, and it was pretty simple too.

The way we have setup now is

A) we have artifactory that mirrors public repos, and also contains artifacts from 3rd party products that we have bought, and also out own artifacts
B) each developer has maven installed
C) most developers have eclipse + m2eclipse
D) the root Pom of our projects points to the artifactory, which mirrors public repos

Whenever someone does a build on their local, if an artifact is not in their local repo, maven asks artifactory for the artifact. Artifactory checks its own local repo. If its not there in the artifactory's repo, it gets it from the public repo and caches it in its own repo for next time.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15959

To get Maven running on a developer or build machine:

1. download/install a JDK
2. download/unzip Maven (on Linux, I place it in /usr/local).
3. Set JAVA_HOME environment variable to point to the installed JDK directory
3. Set MAVEN_HOME environment variable to point to the installed Maven directory.

To "prime the pump".

Pick a project, any project. As long as it has a pom.xml. run "mvn clean compile". Go to lunch while Maven downloads all the dependencies and caches them. Subsequent builds will use the cache and run much faster.

For a shared repository, I've been using Nexus, which allows me to post snapshot builds as sharable dependencies.

Customer surveys are for companies who didn't pay proper attention to begin with.
Peter Johnson

Joined: May 14, 2008
Posts: 5812

I second Tim's recommendation for Nexus. And I also think that is what you really want when you wrote "setting up a brand new Maven repository for our development team". You would set up Nexus on a server in your company and then all of your developers would configure Maven to use your Nexus repository (instead of defaulting to Maven Central).

In our dev environment we store our sources in Subversion, use Jenkins to run the builds, and have our pom.xmls configured to "deploy" built artifacts to Nexus. This have been working very well for us. Each server (Subversion, Jenkins, Nexus) is running on its own machine (actually, they are all VMs in our private cloud), and we have additional VMs set up as Jenkins build slaves (some of our teams have very specific build environment requirements).

JBoss In Action
Mike London
Ranch Hand

Joined: Jul 12, 2002
Posts: 1043
Thanks or the great replies. I would have thanked everyone sooner, but my email address needed to be updated here on the ranch.

Consider Paul's rocket mass heater.
subject: Setting up new Maven Installation and Local Repository -- How best to to it?
Similar Threads
Maven Integration With Subversion
Change maven local repository in Sonatype plug for eclipse
Can some one please explain why do i need MAVEN here
Maven: What's the big deal?
Recovering CVS Repository