Our project is using Nexus Repository Manager to store all the jars. Along with the jar I see that under a group there are other files like pom.xml, .md5, .sha1 file. I am in need of these files at our server startup. Is there a way that I can download all the files under a particular group programatically using Java/Curl command/mvn dependency command at runtime?
Download all files under a groupId from Maven Repository through command or Java program
2.2k views Asked by Swapnil Jaju At
2
There are 2 answers
0
On
I could do it with the simple approach. Club all the xmls into a JAR/ZIP file and upload that zip file under my groupId to the Maven Repository. Then programatically use CURL/WGET to download the zip and unzip the contents of that zip file (using any available utility) at runtime.
- Put all XMLs under a zip file.
- Use mvn deploy to load this zip file to my Maven Nexus Repo.
- Then Programatically during runtime, download the zip file using simple weburl call to that ZIP file.
- Use ZIP4J or any other library to unzip the contents to my required output folder
- Pick files from this server when needed during the flow.
Hope its helpful to someone somewhere sometime. :)
Maven also uses local repository for caching. The default location is
Default: ${user.home}/.m2/repository
. You can check this setting in file settings.xml under [maven_dir]/conf/.To update dependencies, use
-U
option. i.e.mvn clean install -U
Do not forget setting nexus repo inside pom.xml file http://maven.apache.org/pom.html#Repository