Thursday, December 03, 2009

Mass Imports of Maven Repositories into Archiva

Credit goes to Fugang Wang for this crafty trick.  Archiva is a Web-based system for managing your Maven repositories.  Unfortunately the Web interface only allows you to upload one jar at a time, and you also need to provide metadata (artifactId, version, group, etc).  This isn't very useful if you need to import a few dozen or more jars.

Here is how to import an existing local repository (that is, your $HOME/.m2 directory) into Archiva:

1. Create a new named repository, say cyberaide. Then you'll get a directory 'cyberaide' under the archiva installation directory.
2. Move the whole repo directory under the newly created directory.
3. Click the 'Repository scanning' button for your repository. This will 'repair' the artifacts db so the newly added artifacts would show up.

No comments: