Maven: download all the artifacts of a group
I am using maven 3.0 with nexus as remote repository. I am wondering, is there a way to download all the artifacts with the same groupId using maven without knowing the name of all the artifacts? In other words, is it possible to download all the artifacts from remote repository automatically by only mentioning the group Id?
For example, I want to download all the artifacts in group com.example.here to my local repository:
<artifactId>a1</artifactId> ... <artifactId>an</artifactId>
and the version that I want is the latest.
You can use lftp (should be included in many UNIX distributions) to mirror a part of a Maven repository. Since the repository uses sub-directories based on groupIDs, you can use that do fetch all artifacts belonging to a certain group. E.g.
$ lftp https://repository.jboss.org/nexus/content/groups/public/apache-xalan/ -e 'mirror .'
Will grab everything under the apache-xalan groupId.
This may not work with every Maven repository. Some may only allow access to the directory structure at a certain depth or not at all.
Its not possible to do this since a dependency in maven needs to be referred by groupId:artifactId:version:classifier (optional).
One way I can think of is to create an assembly project that has dependencies on all the projects you want to download and the version optionally set to LATEST. You can use maven assembly plugin to create an archive from the dependency sets.