diff --git a/createAndDeploy.sh b/createAndDeploy.sh index 903d16e..0ed0a40 100755 --- a/createAndDeploy.sh +++ b/createAndDeploy.sh @@ -8,14 +8,38 @@ gCubePrefix=org.gcube gCubeGroupId=org.gcube.common -#repositoryId=gcube-snapshots -#repositoryUrl=http://maven.research-infrastructures.eu/nexus/content/repositories/gcube-snapshots +repositoryId=gcube-releases +repositoryUrl=http://maven.research-infrastructures.eu/nexus/content/repositories/gcube-releases -#repositoryId=gcube-externals -repositoryUrl=http://maven.research-infrastructures.eu/nexus/content/repositories/gcube-externals +username= +password= + +function showhelp { + echo -e "\nUsage: createAndDeploy.sh -u -p [-h]\n" + echo -e " -h = shows this help.\n" +} + +while getopts ":u:p:h" opt; do + case $opt in + u) username=$OPTARG;; + p) password=$OPTARG;; + h) showhelp + exit 0 ;; + \?) echo -e "\nERROR:invalid option: -$OPTARG"; + showhelp; + echo -e "\naborting.\n" + exit 1 >&2 ;; + esac +done + +settingsFile=jenkins-releases-settings.xml +rm ${settingsFile} +wget https://code-repo.d4science.org/gCubeSystem/Configs/raw/branch/master/Maven/1.1.0/${settingsFile} + +sed -i 's/{{ gcube_maven_user }}/'"${username}"'/g' ${settingsFile} +sed -i 's/{{ gcube_maven_pwd }}/'"${password}"'/g' ${settingsFile} for i in jackson-core jackson-annotations jackson-databind -#for i in jackson-core do jacksonArtifactId=$i @@ -52,20 +76,25 @@ do 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 + cd ${projectDir} + mkdir ${gCubeArtifactId} + mv ${projectDir}/target/${gCubeArtifactJar} ${gCubeArtifactId} - #mvn -U install:install-file -DpomFile=deploy.pom.xml -Dfile=${gCubeArtifactJar} - #mvn -U deploy:deploy-file -DpomFile=deploy.pom.xml -Dfile=${gCubeArtifactJar} -DrepositoryId=${repositoryId} - - mvn -U deploy:deploy-file -DpomFile=deploy.pom.xml -Dfile=${gCubeArtifactJar} -Durl=${repositoryUrl} - - cd ${projectDir} mvn clean rm pom.xml rm dependency-reduced-pom.xml + + cd ${gCubeArtifactId} + + cp ${projectDir}/pom.deploy.template.${jacksonArtifactId}.xml pom.xml + sed -i 's/JACKSON_ARTIFACT_ID/'"${jacksonArtifactId}"'/g' pom.xml + sed -i 's/JACKSON_VERSION/'"${jacksonVersion}"'/g' pom.xml + + mvn -s ../jenkins-releases-settings.xml -U deploy:deploy-file -DpomFile=pom.xml -Dfile=${gCubeArtifactJar} -DrepositoryId=${repositoryId} -Durl=${repositoryUrl} + + cd ${projectDir} + rm -rf ${gCubeArtifactId} done +cd ${projectDir} +rm ${settingsFile} diff --git a/pom.deploy.template.jackson-annotations.xml b/pom.deploy.template.jackson-annotations.xml index 7f34a8c..ef97719 100644 --- a/pom.deploy.template.jackson-annotations.xml +++ b/pom.deploy.template.jackson-annotations.xml @@ -2,6 +2,12 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + + + org.gcube.tools + maven-parent + 1.1.0 + org.gcube.common gcube-JACKSON_ARTIFACT_ID diff --git a/pom.deploy.template.jackson-core.xml b/pom.deploy.template.jackson-core.xml index 7f34a8c..d648740 100644 --- a/pom.deploy.template.jackson-core.xml +++ b/pom.deploy.template.jackson-core.xml @@ -3,6 +3,12 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + + org.gcube.tools + maven-parent + 1.1.0 + + org.gcube.common gcube-JACKSON_ARTIFACT_ID JACKSON_VERSION diff --git a/pom.deploy.template.jackson-databind.xml b/pom.deploy.template.jackson-databind.xml index a25dcd4..370ee62 100644 --- a/pom.deploy.template.jackson-databind.xml +++ b/pom.deploy.template.jackson-databind.xml @@ -3,6 +3,12 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 + + org.gcube.tools + maven-parent + 1.1.0 + + org.gcube.common gcube-JACKSON_ARTIFACT_ID JACKSON_VERSION