I'm new to maven world. My organization has maven release process all the artifacts are kept in our maven remote repo, so I want to deliver some specific artifact version to some of our customer. How can I download specific module version?
1 Answers
In case you don't have a web interface like Nexus for your internal repo, you can create a standalone pom.xml
, enter the desired version into the dependencies
and call mvn package
.
If you need some sample poms and extra info to get you started, you can look here and here
EDIT : I forgot you might expect the artifact to turn up in the same folder as the pom is in. The default maven setting is to download it to a subfolder of /yourHomeFolder/.m2/repository/
The name of the subfolder is the group Id of the artifact.
EDIT2: here is a sample setup for downloading the jars into the folder of your choice. If you delete the <outpuDirectory>
setting, the artifact jar will be downloaded into the subfolder /dependendies
. The execution is bound to the validate
phase, so just call mvn validate
<build>
...
<plugins>
<!-- Dependency plugin to download the configured dependencies (transitive). -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<execution>
<execution>
<id>download-jar</id>
<phase>validate</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>put/your/directory/here</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
![](../../users/profiles/216021.webp)
- 56,537
- 45
- 164
- 213
-
Thank You Kostja.....I will try what you mention. Is there any way to use mvn dependency:copy-dependencies maven functional for this because I really want download jar file to my specific folder. I have a remote nexus repo – user1741249 Oct 13 '12 at 03:54