Skip to content

Instantly share code, notes, and snippets.

@ryantenney
Created June 9, 2014 23:32
Show Gist options
  • Select an option

  • Save ryantenney/f522cfaf38fa300d5c3a to your computer and use it in GitHub Desktop.

Select an option

Save ryantenney/f522cfaf38fa300d5c3a to your computer and use it in GitHub Desktop.

Revisions

  1. ryantenney created this gist Jun 9, 2014.
    20 changes: 20 additions & 0 deletions mvn-upgrade.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    jar=$1
    propertiesFile=`tar -tvf $jar | grep pom.properties | awk ' { print $9 } '`
    properties=`tar -xf $jar -O $propertiesFile`

    groupId=`echo "$properties" | grep groupId | awk -F'=' ' { print $2 }'`
    artifactId=`echo "$properties" | grep artifactId | awk -F'=' ' { print $2 }'`

    jar=$artifactId.jar

    mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get \
    -Dartifact="$groupId:$artifactId:LATEST" \
    -Dpackaging=jar \
    -Ddest=$jar

    propertiesFile=`tar -tvf $jar | grep pom.properties | awk ' { print $9 } '`
    properties=`tar -xf $jar -O $propertiesFile`

    version=`echo "$properties" | grep version | awk -F'=' ' { print $2 }'`

    mv "$jar" "$artifactId-$version.jar"