Script for batch installation of maven artifacts
Leave a comment Posted by akhikhl on June 6, 2013
I created gradle script that delivers batch installation of maven artifacts to local maven repository (source code here: https://github.com/akhikhl/contribs).
The script supports two tasks – installContribs and cleanContribs – but can be extended with additional tasks (for example, implementing deployment to corporate repo).
how it works:
1. you call it with the command-line:
gradle -b contribs.gradle
(or you rename script to “build.gradle” and just put it somewhere in the multi-project tree, it will be called by gradle automatically).
2. installContribs task iterates the current folder (where the script resides) and all it’s subfolders
3. in each folder it iterates files with extension “pom”
4. for each found pom-file it looks for “.jar”, “-sources.jar” and “-javadoc.jar” and install all found files (together with pom) to the local maven repository.
5. pom-file without jars will be installed as an artifact on it’s own. Typical use-case: installation of parent-poms and aggregator-poms.
The script accurately calculates inputs/outputs. If all files were not changed since the last installation, it does not install anything and shows “UP-TO-DATE” in the console.
cleanContribs task makes script “forget” about the time of the last artifact installation. As the result, running script with installContribs task will install all artifacts anew.
gradle, Programming Apache Maven, Command-line interface, contribs, deploy, gradle, install, JAR (file format), javadoc, Languages, maven, Operating Systems, pom, programming, script, Source code, sources