gcube-jackson-relocator/createAndDeploy.sh

64 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
jacksonGroupId=com.fasterxml.jackson.core
jacksonVersion=2.6.0
jacksonOriginalPackage=com.fasterxml.jackson
gCubePrefix=org.gcube
gCubeGroupId=org.gcube.common
for i in jackson-core jackson-annotations jackson-databind
#for i in jackson-core
do
jacksonArtifactId=$i
cp pom.repackage.template.xml pom.xml
sed -i 's/JACKSON_GROUP_ID/'"${jacksonGroupId}"'/g' pom.xml
sed -i 's/JACKSON_ARTIFACT_ID/'"${jacksonArtifactId}"'/g' pom.xml
sed -i 's/JACKSON_VERSION/'"${jacksonVersion}"'/g' pom.xml
sed -i 's/JACKSON_ORIGINAL_PACKAGE/'"${jacksonOriginalPackage}"'/g' pom.xml
sed -i 's/GCUBE_PREFIX/'"${gCubePrefix}"'/g' pom.xml
projectDir=${PWD}
mvn -U clean package
cd target
repackagedJacksonArtifact=repackaged-${jacksonArtifactId}-${jacksonVersion}
unzip ${repackagedJacksonArtifact}.jar -d ${repackagedJacksonArtifact}
if [ -d "${repackagedJacksonArtifact}/META-INF/services" ]; then
cd ${repackagedJacksonArtifact}/META-INF/services
for FILE in ${jacksonOriginalPackage}.*
do
sed -i 's/'"${jacksonOriginalPackage}"'/'"${gCubePrefix}.${jacksonOriginalPackage}"'/g' ${FILE}
mv ${FILE} ${gCubePrefix}.${FILE}
done
fi
gCubeArtifactJar=gcube-${jacksonArtifactId}-${jacksonVersion}.jar
gCubeArtifactId=gcube-${jacksonArtifactId}
cd ${projectDir}/target/${repackagedJacksonArtifact}
zip -r ../${gCubeArtifactJar} .
cd ${projectDir}/target
cp ../pom.deploy.template.${jacksonArtifactId}.xml deploy.pom.xml
sed -i 's/JACKSON_ARTIFACT_ID/'"${jacksonArtifactId}"'/g' deploy.pom.xml
sed -i 's/JACKSON_VERSION/'"${jacksonVersion}"'/g' deploy.pom.xml
mvn install:install-file -DpomFile=deploy.pom.xml -Dfile=${gCubeArtifactJar}
#mvn deploy:deploy-file -DpomFile=deploy.pom.xml -Dfile=${gCubeArtifactJar}
cd ${projectDir}
mvn clean
rm pom.xml
rm dependency-reduced-pom.xml
done