gcube-jackson-relocator/createAndDeploy.sh

64 lines
1.8 KiB
Bash
Raw Normal View History

2020-04-28 17:56:21 +02:00
#!/bin/bash
jacksonGroupId=com.fasterxml.jackson.core
jacksonVersion=2.6.0
2020-04-28 17:56:21 +02:00
jacksonOriginalPackage=com.fasterxml.jackson
2020-04-28 18:18:46 +02:00
gCubePrefix=org.gcube
gCubeGroupId=org.gcube.common
2020-04-28 17:56:21 +02:00
for i in jackson-core jackson-annotations jackson-databind
#for i in jackson-core
2020-04-28 17:56:21 +02:00
do
jacksonArtifactId=$i
cp pom.repackage.template.xml pom.xml
2020-04-28 17:56:21 +02:00
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
2020-04-28 18:18:46 +02:00
sed -i 's/GCUBE_PREFIX/'"${gCubePrefix}"'/g' pom.xml
2020-04-28 17:56:21 +02:00
projectDir=${PWD}
mvn -U clean package
cd target
2020-04-28 18:18:46 +02:00
repackagedJacksonArtifact=repackaged-${jacksonArtifactId}-${jacksonVersion}
unzip ${repackagedJacksonArtifact}.jar -d ${repackagedJacksonArtifact}
if [ -d "${repackagedJacksonArtifact}/META-INF/services" ]; then
cd ${repackagedJacksonArtifact}/META-INF/services
2020-04-28 17:56:21 +02:00
for FILE in ${jacksonOriginalPackage}.*
do
2020-04-28 18:18:46 +02:00
sed -i 's/'"${jacksonOriginalPackage}"'/'"${gCubePrefix}.${jacksonOriginalPackage}"'/g' ${FILE}
mv ${FILE} ${gCubePrefix}.${FILE}
2020-04-28 17:56:21 +02:00
done
fi
2020-04-28 18:18:46 +02:00
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}
2020-04-28 17:56:21 +02:00
cd ${projectDir}
mvn clean
2020-04-28 17:56:21 +02:00
rm pom.xml
2020-04-28 18:18:46 +02:00
rm dependency-reduced-pom.xml
2020-04-28 17:56:21 +02:00
done