A script to add 3rd party artifacts to your maven repository



I find the maven command line very obtuse and have trouble remembering the right incantation to add 3rd party jars to a local repository.


Here is a small bash script which might be useful to others. You will need to edit this for your environment.


#!/bin/bash
# Add 3rd party jars to maven in a batch
# Usage: madd groupid version jar1 jar2 ...
#
# Edit the mvn command as per your repo setup

if [ $# -lt 3 ]; then
echo Usage: $0 groupid version jar1 jar2...
exit 1
fi

GROUPID=$1
shift
VERSION=$1
shift

for file in $\*
do
ARTIFACTID=`echo $file | sed -e 's/\\.jar//'`
mvn deploy:deploy-file -DgroupId=$GROUPID -DartifactId=$ARTIFACTID \\
-Dversion=$VERSION -Dpackaging=jar -Dfile=$file \\
-Durl=http://localhost:8081/nexus/content/repositories/thirdparty \\
-DrepositoryId=thirdparty
done

Comments:

Post a Comment:
Comments are closed for this entry.
About

Things that amuse me

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
News

No bookmarks in folder

Blogroll