diff --git a/.gitignore b/.gitignore index 99afcfa7563166dc7406c5583c37811a330aeb66..333dba2018ff50d3b9b52858f684821457555171 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,9 @@ target/ .project .settings .gitlab-ci-local +.m2/ +!.m2/settings.xml +.mvn/ # IDE .settings/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e3ec261ef538e8315ae23007103e532b0f52d8ca..cbda740f18643b4c39e6d1ca8170786cc83a34d9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,7 @@ image: dimage-base-release.repo-ex.zcdi.dataport.de/sdks/maven:3.9.2-java-21 variables: MAVEN_CLI_OPTS: "-s .m2/settings.xml --batch-mode" + MAVEN_DEPLOY_CLI_OPTS: "--no-transfer-progress" MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository" cache: @@ -13,9 +14,26 @@ cache: package: stage: build script: - - export DATAPORT_PROXY=$DATAPORT_PROXY + - export DATAPORT_PROXY_CLI=$DATAPORT_PROXY - mvn $MAVEN_CLI_OPTS package artifacts: paths: - target/*.jar + rules: + - if: $CI_COMMIT_BRANCH != "main" +deploy_to_artifactory: + stage: deploy + script: + - export DATAPORT_PROXY_CLI=$DATAPORT_PROXY + - mvn -P artifactory-deploy $MAVEN_DEPLOY_CLI_OPTS $MAVEN_CLI_OPTS deploy + only: + - main + +deploy_to_nexus: + stage: deploy + script: + - export DATAPORT_PROXY_CLI=$DATAPORT_PROXY + - mvn -P nexus-deploy $MAVEN_DEPLOY_CLI_OPTS $MAVEN_CLI_OPTS deploy + only: + - main diff --git a/.m2/settings.xml b/.m2/settings.xml index 7a5f70a3c596b4aace20d91aa649c39633573ebc..8b317f9b5cc8ae7fb8c5f7899946de0c22761051 100644 --- a/.m2/settings.xml +++ b/.m2/settings.xml @@ -12,6 +12,16 @@ <username>${env.Artifactory_REPO_USER}</username> <password>${env.Artifactory_REPO_PASS}</password> </server> + <server> + <id>ozg-nexus</id> + <username>${env.Nexus_REPO_USER}</username> + <password>${env.Nexus_REPO_PASS}</password> + </server> + <server> + <id>ozg-snapshots-nexus</id> + <username>${env.Nexus_REPO_USER}</username> + <password>${env.Nexus_REPO_PASS}</password> + </server> </servers> <profiles> <profile> diff --git a/pom.xml b/pom.xml index 95f8b3d174862cdcbb55e5dccb430adeb622a3cc..4b455ce2ebd11ae786081829c84d85b9e282f8a3 100644 --- a/pom.xml +++ b/pom.xml @@ -13,5 +13,44 @@ <maven.compiler.target>21</maven.compiler.target> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> - + + <profiles> + <!-- Deployment Profiles --> + <profile> + <id>artifactory-deploy</id> + <activation> + <activeByDefault>false</activeByDefault> + </activation> + <distributionManagement> + <repository> + <id>artifactory</id> + <name>artifactory</name> + <url>${env.DATAPORT_ARTIFACTORY_URL}</url> + </repository> + <snapshotRepository> + <id>artifactory-snapshots</id> + <name>artifactory-snapshots</name> + <url>${env.DATAPORT_ARTIFACTORY_URL}</url> + </snapshotRepository> + </distributionManagement> + </profile> + <profile> + <id>nexus-deploy</id> + <activation> + <activeByDefault>false</activeByDefault> + </activation> + <distributionManagement> + <repository> + <id>ozg-nexus</id> + <name>ozg-releases</name> + <url>https://nexus.ozg-sh.de/repository/ozg-releases/</url> + </repository> + <snapshotRepository> + <id>ozg-snapshots-nexus</id> + <name>ozg-snapshots</name> + <url>https://nexus.ozg-sh.de/repository/ozg-snapshots/</url> + </snapshotRepository> + </distributionManagement> + </profile> + </profiles> </project> \ No newline at end of file