Implementing repackager

This commit is contained in:
Luca Frosini 2020-04-28 18:18:46 +02:00
parent 21253ed41a
commit 668bbf247a
3 changed files with 26 additions and 10 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
/.project
/.settings/
/target/

View File

@ -4,7 +4,9 @@ jacksonGroupId=com.fasterxml.jackson.core
jacksonVersion=2.10.3
jacksonOriginalPackage=com.fasterxml.jackson
gcubePrefix=org.gcube
gCubePrefix=org.gcube
gCubeGroupId=org.gcube.common
#for i in jackson-core jackson-annotations jackson-databind
for i in jackson-core
@ -18,28 +20,41 @@ do
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
sed -i 's/GCUBE_PREFIX/'"${gCubePrefix}"'/g' pom.xml
projectDir=${PWD}
mvn -U clean package
cd target
unzip gcube-${jacksonArtifactId}-1.0.0.jar -d ${jacksonArtifactId}
if [ -d "${jacksonArtifactId}/META-INF/services" ]; then
cd ${jacksonArtifactId}/META-INF/services
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}
sed -i 's/'"${jacksonOriginalPackage}"'/'"${gCubePrefix}.${jacksonOriginalPackage}"'/g' ${FILE}
mv ${FILE} ${gCubePrefix}.${FILE}
done
fi
cd ${projectDir}/target/${jacksonArtifactId}
zip -r ../gcube-${jacksonArtifactId}-${jacksonVersion}.jar .
gCubeArtifactJar=gcube-${jacksonArtifactId}-${jacksonVersion}.jar
gCubeArtifactId=gcube-${jacksonArtifactId}
cd ${projectDir}/target/${repackagedJacksonArtifact}
zip -r ../${gCubeArtifactJar} .
cd ${projectDir}/target
mvn install:install-file -DgroupId=${gCubeGroupId} -DartifactId=${gCubeArtifactId} -Dversion=${jacksonVersion} -Dpackaging=jar -Dfile=${gCubeArtifactJar}
#mvn deploy:deploy-file -DgroupId=${jacksonGroupId} -DartifactId=gcube-${jacksonArtifactId} -Dversion=${jacksonVersion} -Dpackaging=jar -Dfile=${finalJarFileName}.jar
cd ${projectDir}
#mvn clean
rm pom.xml
rm dependency-reduced-pom.xml
done

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.gcube.common</groupId>
<artifactId>JACKSON_ARTIFACT_ID</artifactId>
<artifactId>repackaged-JACKSON_ARTIFACT_ID</artifactId>
<version>JACKSON_VERSION</version>
<description>JACKSON_ARTIFACT_ID repackaged artifact</description>
<packaging>jar</packaging>