Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating/Accessing Maven repository in SVN through NetBeans 6.7 *Revised*

EDIT: Ok... so I've gathered that SVN shouldn't really be used for this... which makes sense, I suppose (why version individual files when the version should be a separate jar?).

So we should use an internal server to host a repository management tool like Nexus (etc), and access that over http to pull down and put out dependencies. We are keeping our projects in SVN now. What is the standard for deployments? Dependencies go into Maven. Projects go into SVN. Should we ignore the dist and build folders? Where would our WAR files get deployed from?

OLD QUESTION (for posterity)

I'm brand new to Maven and don't know jack about it. I'm trying to evaluate it to see how it will do with our Java development.

I would like to have a Maven repository in our SVN server so that dependencies can be pulled down from there using NetBeans 6.7. I have not been able to find how to do this throughout many google and stackoverflow searches.

What are the best practices here? I'm thinking that we'd want to download dependencies using svn+ssh, but most things online seem to point to using http.

Fill my brain with great things!


like image 824
Buns of Aluminum Avatar asked Sep 17 '09 20:09

Buns of Aluminum


2 Answers

I'd strongly recommend against doing this. Maven artifacts don't belong on an SCM server. You should consider using a repository manager like Nexus to store your artifacts. See here for a comparison of the main repository managers.

Having said that. If you are determined to use Subversion to host your artifacts. See this question on using the wagon scm to deploy to a Subversion repository.

If you want to find out more about Maven, check out Maven: the definitive guide.

There is a Maven plugin for Netbeans that will manage dependencies. This article lists some best practices for Maven and Netbeans.


Update based on your updated question. What to do with your own jars:

Maven has a deploy phase that will publish your artifacts to the remote repository. You need to configure the distributionManagement section of the pom, and provide appropriate credentials in your settings.xml to allow the deployment to happen. Typically you would set up a discrete logical repository on the server for your own artifacts to keep them isolated from third party artifacts. The Nexus book gives some good guidance on configuring repositories on Nexus. In particular see the Adopting a Repository Manager section.

If you have configured your project correctly, run mvn deploy and all phases up to and including the deploy phase will run, and your artifact will be published to the repository, available for use by the rest of your team/company.

If you need to restrict access to repositories, you can configure access controls to your repository so only authenticated users can access those artifacts (for Nexus see the Managing Security section of the book for guidance).

It's worth noting you can do largely the same things (more or less) with Artifactory or Archiva as Nexus, I've included Nexus references because I prefer it, and the documentation is really good.

like image 181
Rich Seller Avatar answered Sep 29 '22 09:09

Rich Seller


Don't store them in SVN.

I would do two things to make sure you're not getting too many headaches:

  1. Mirror a repository closer to your box someplace that you and your workmates can share. This will eliminate extra downloading and allow you to fix any problems that may come up (and they will) with the mirrored pom/jar files so your mates don't have to share in the headache. There are several repo managers out there that help with this.
  2. Do your best to work with your machine repository and push changes/modifications to any pom files that you may make to the local shared repo.
like image 21
Nathan Avatar answered Sep 29 '22 09:09

Nathan