Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Mike London
Ranch Hand
Posts: 1190
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Thanks,

- Mike
 
Jayesh A Lalwani
Rancher
Posts: 2756
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Pie
Posts: 18097
50
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Mike London
Ranch Hand
Posts: 1190
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks or the great replies. I would have thanked everyone sooner, but my email address needed to be updated here on the ranch.

-Mike
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic