From 15d1677cccd36271878b70132f956356d38a6838 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Fri, 13 Jan 2023 11:32:39 +0100 Subject: [PATCH] Improve Maven caching. --- ci/build-and-distribute.bash | 8 +++----- ci/build-spring-data-release-cli.bash | 6 +++++- ci/conclude.bash | 9 ++------- ci/prepare-and-build.bash | 8 +++----- src/main/resources/application-jenkins.properties | 2 +- 5 files changed, 14 insertions(+), 19 deletions(-) diff --git a/ci/build-and-distribute.bash b/ci/build-and-distribute.bash index b2caf6d..1f6dfa3 100755 --- a/ci/build-and-distribute.bash +++ b/ci/build-and-distribute.bash @@ -10,19 +10,17 @@ export JAVA_HOME="$HOME/.sdkman/candidates/java/current" export PATH="$MAVEN_HOME/bin:$JAVA_HOME/bin:$PATH" export JENKINS_HOME=/tmp/jenkins-home -export RELEASE_TOOLS_CACHE=${JENKINS_HOME}/.m2/spring-data-release-tools +export RELEASE_TOOLS_MAVEN_REPOSITORY=$(pwd)/maven-repository export LOGS_DIR=$(pwd)/logs -export SETTINGS_XML=${JENKINS_HOME}/settings.xml +export SETTINGS_XML=$(pwd)/ci/settings.xml -mkdir -p ${RELEASE_TOOLS_CACHE} +mkdir -p ${RELEASE_TOOLS_MAVEN_REPOSITORY} mkdir -p ${LOGS_DIR} export GNUPGHOME=~/.gnupg/ mkdir -p ${GNUPGHOME} chmod 700 ${GNUPGHOME} -cp ci/settings.xml ${JENKINS_HOME} - if test -f application-local.properties; then echo "You are running from dev environment! Using application-local.properties." diff --git a/ci/build-spring-data-release-cli.bash b/ci/build-spring-data-release-cli.bash index 43cf257..de69ee1 100755 --- a/ci/build-spring-data-release-cli.bash +++ b/ci/build-spring-data-release-cli.bash @@ -7,5 +7,9 @@ export JAVA_HOME="$HOME/.sdkman/candidates/java/current" export PATH="$MAVEN_HOME/bin:$JAVA_HOME/bin:$PATH" export JENKINS_HOME=/tmp/jenkins-home +export RELEASE_TOOLS_MAVEN_REPOSITORY=$(pwd)/maven-repository +export SETTINGS_XML=$(pwd)/ci/settings.xml -mvn clean package -B -DskipTests +mkdir -p ${RELEASE_TOOLS_MAVEN_REPOSITORY} + +mvn -Dmaven.repo.local=${RELEASE_TOOLS_MAVEN_REPOSITORY} -s ${SETTINGS_XML} clean package -B -DskipTests diff --git a/ci/conclude.bash b/ci/conclude.bash index 8202a5a..3dbcc62 100755 --- a/ci/conclude.bash +++ b/ci/conclude.bash @@ -10,9 +10,9 @@ export JAVA_HOME="$HOME/.sdkman/candidates/java/current" export PATH="$MAVEN_HOME/bin:$JAVA_HOME/bin:$PATH" export JENKINS_HOME=/tmp/jenkins-home -export RELEASE_TOOLS_CACHE=${JENKINS_HOME}/.m2/spring-data-release-tools +export RELEASE_TOOLS_MAVEN_REPOSITORY=${JENKINS_HOME}/.m2/spring-data-release-tools export LOGS_DIR=${JENKINS_HOME}/spring-data-shell/logs -export SETTINGS_XML=${JENKINS_HOME}/settings.xml +export SETTINGS_XML=$(pwd)/ci/settings.xml export GNUPGHOME=~/.gnupg/ if test -f application-local.properties; then @@ -22,11 +22,7 @@ if test -f application-local.properties; then function spring-data-release-shell { java \ - "-Ddeployment.settings-xml=${SETTINGS_XML}" \ "-Ddeployment.local=true" \ - "-Dmaven.mavenHome=${MAVEN_HOME}" \ - "-Dgpg.executable=/usr/bin/gpg" \ - "-Dio.workDir=dist" \ -jar target/spring-data-release-cli.jar } else @@ -41,7 +37,6 @@ else function spring-data-release-shell { java \ -Dspring.profiles.active=jenkins \ - -Dmaven.home=${MAVEN_HOME} \ -jar target/spring-data-release-cli.jar } fi diff --git a/ci/prepare-and-build.bash b/ci/prepare-and-build.bash index b226c2a..8077cd0 100755 --- a/ci/prepare-and-build.bash +++ b/ci/prepare-and-build.bash @@ -10,19 +10,17 @@ export JAVA_HOME="$HOME/.sdkman/candidates/java/current" export PATH="$MAVEN_HOME/bin:$JAVA_HOME/bin:$PATH" export JENKINS_HOME=/tmp/jenkins-home -export RELEASE_TOOLS_CACHE=${JENKINS_HOME}/.m2/spring-data-release-tools +export RELEASE_TOOLS_MAVEN_REPOSITORY=$(pwd)/maven-repository export LOGS_DIR=$(pwd)/logs -export SETTINGS_XML=${JENKINS_HOME}/settings.xml +export SETTINGS_XML=$(pwd)/ci/settings.xml -mkdir -p ${RELEASE_TOOLS_CACHE} +mkdir -p ${RELEASE_TOOLS_MAVEN_REPOSITORY} mkdir -p ${LOGS_DIR} export GNUPGHOME=~/.gnupg/ mkdir -p ${GNUPGHOME} chmod 700 ${GNUPGHOME} -cp ci/settings.xml ${JENKINS_HOME} - if test -f application-local.properties; then echo "You are running from dev environment! Using application-local.properties." diff --git a/src/main/resources/application-jenkins.properties b/src/main/resources/application-jenkins.properties index 6e90099..47ca4e0 100644 --- a/src/main/resources/application-jenkins.properties +++ b/src/main/resources/application-jenkins.properties @@ -22,7 +22,7 @@ sagan.key=n/a maven.maven-home=${MAVEN_HOME} maven.console-logger=false -maven.local-repository=${RELEASE_TOOLS_CACHE} +maven.local-repository=${RELEASE_TOOLS_MAVEN_REPOSITORY} maven.parallelize=true io.workDir=dist