I have a gitlab pipeline where I build 2 projects.
Frist project:
buildcore:
stage: core
tags:
- docker
image: maven:3.8.6-eclipse-temurin-17-focal
before_script:
- cat ${SSH_BITBUCKET_KEY} | base64 -d > ${SSH_BITBUCKET_KEY}.tmp && mv ${SSH_BITBUCKET_KEY}.tmp
${SSH_BITBUCKET_KEY} && chmod 600 ${SSH_BITBUCKET_KEY}
- git clone ssh://git@git:7999/ingo/core.git
script:
- ls -la
- cd core
- MAVEN_OPTS="-Xrs -Xmx1024m -Xss1m" mvn install -Pbuild
-Dmaven.repo.local=mvn.repo
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
-s ${CI_PROJECT_DIR}/.gitlab/settings.xml
- echo "Ende!"
- ls -la
- cd mvn.repo
- ls -la
artifacts:
paths:
- ${CI_PROJECT_DIR}/core/mvn.repo/**/*
expire_in: 3 day
Works fine, everything was build and artifacts uploaded.
Next I try to build a second project with the artifacts from core.
buildapp:
stage: app
#when: manual
tags:
- docker
image: maven:3.8.6-eclipse-temurin-17-focal
before_script:
- cat ${SSH_BITBUCKET_KEY} | base64 -d > ${SSH_BITBUCKET_KEY}.tmp && mv ${SSH_BITBUCKET_KEY}.tmp
${SSH_BITBUCKET_KEY} && chmod 600 ${SSH_BITBUCKET_KEY}
- git clone ssh://git@git:7999/ingo/myapp.git
script:
- cd myapp/myapp
- MAVEN_OPTS="-Xrs -Xmx1024m -Xss1m" mvn install -P build
-Dmaven.repo.local=../../core/mvn.repo
-s ${CI_PROJECT_DIR}/.gitlab/settings.xml
- echo "Ende!"
The artifacts from core build were added the correct way. So I have:
${CI_PROJECT_DIR}/core/mvn.repo
${CI_PROJECT_DIR}/myapp/myapp
I set the repo to the core/mvn.repo
But maven reports that the artifacst cannot be found.
[ERROR] Failed to execute goal on project xxx.myappexecutor: Could not resolve dependencies for project com.ingo:xxx.myappexecutor:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: com.ingo:xxx.myapp.app:jar:2.8.0-SNAPSHOT, com.ingo:ct.myapp:jar:2.8.0-SNAPSHOT....and so forth
All dependencies are inside the “${CI_PROJECT_DIR}/core/mvn.repo” but it seems Maven cannot find them.
I trieds also with a full path in repo:
-Dmaven.repo.local=${CI_PROJECT_DIR}/core/mvn.repo
But no effect. Any hint what I do wrong?