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 /.project
/.settings/ /.settings/
/target/

View File

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

View File

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