Skip to content

Instantly share code, notes, and snippets.

@jhaber
Created November 30, 2017 21:41
Show Gist options
  • Save jhaber/55c0dbcb5d9aa59d53debc70123a2a1e to your computer and use it in GitHub Desktop.
Save jhaber/55c0dbcb5d9aa59d53debc70123a2a1e to your computer and use it in GitHub Desktop.
#!/bin/bash
set -e
libdir="$M2_HOME/lib"
cd $libdir
resolverjar=`ls maven-resolver-impl-*.jar`
tmpdir=`mktemp -d -t maven.XXXXXX`
cd $tmpdir
extensionjar="accelerator-maven-extension-0.3-shaded.jar"
if [ ! -f "$libdir/$extensionjar" ]; then
curl -L -O "https://repo1.maven.org/maven2/com/hubspot/snapshots/accelerator-maven-extension/0.3/$extensionjar"
mv "$extensionjar" "$libdir"
fi
if [[ $resolverjar != *modified* ]]; then
cp "$libdir/$resolverjar" "$tmpdir/$resolverjar"
unzip -n -q $resolverjar -d maven-resolver-impl
rm maven-resolver-impl/org/eclipse/aether/internal/impl/DefaultUpdateCheckManager.class
cd maven-resolver-impl
modifiedjar="${resolverjar/.jar/-modified.jar}"
jar cf "$tmpdir/$modifiedjar" *
cd ..
mkdir -p "$libdir/backup"
mv "$libdir/$resolverjar" "$libdir/backup"
mv $modifiedjar "$libdir"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment