Hello everyone,
I have a weird problem.
When building projects in a multi-module setup with bnd-maven-plugin where my project structure is like this:
maven-master/
– .gitlab-ci.yml
– pom.xml // packaging pom
– maven_module_and_git_submodule/
---- pom.xml // packaging pom
---- actual_project_1/
------ bnd.bnd // Export-Package : exported_package_1,\
----------------------- exported_package_2
------ pom.xml // packaging jar, version e.g. 24.8.0
------ src/main/java/
-------- actual_project_1.exported_package_1/
---------- package-info.java // containing @org.osgi.annotation.versioning.Version(“1.0.0”)
---------- // other sources
-------- actual_project_1.exported_package_2/
---------- packageinfo // containing version 1.0.0
---------- // other sources
locally, this builds fine so the resulting manifests contain
Export-Package: exported_package_1;version=“1.0.0”,exported_package_2;version=“1.0.0”.
But if I download an artifact built by Gitlab CI from its own package registry, which I’m using to deploy into, the manifest contains
Export-Package: exported_package_1;version=“24.8.0”,exported_package_2;version=“24.8.0”
Here is my .gitlab-ci.yml:
stages:
- test
- deploy
variables:
MAVEN_OPTS: >-
-Dhttps.protocols=TLSv1.2
-Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository
-Dorg.slf4j.simpleLogger.showDateTime=true
-Djava.awt.headless=true
MAVEN_CLI_OPTS: >-
--batch-mode
--errors
--fail-at-end
--show-version
--no-transfer-progress
-DinstallAtEnd=true
-DdeployAtEnd=true
GIT_SUBMODULE_STRATEGY: recursive
GIT_SUBMODULE_FORCE_HTTPS: "true"
GIT_SUBMODULE_DEPTH: 1
image: maven:3-eclipse-temurin-17
cache:
paths:
- .m2/repository
.verify:
stage: test
script:
- 'mvn clean'
- 'mvn validate'
- 'mvn $MAVEN_CLI_OPTS clean verify -U --settings ci_settings.xml'
.trustCert:
before_script:
- 'keytool -trustcacerts -cacerts -storepass REDACTED -importcert -alias REDACTED -file $REDACTED --noprompt'
verify:jdk17:
extends:
- .trustCert
- .verify
deploy:jdk17:
cache: []
stage: deploy
extends:
- .trustCert
script:
- if [ ! -f ci_settings.xml ]; then
echo "CI settings missing\! If deploying to GitLab Maven Repository, please see https://docs.gitlab.com/ee/user/packages/maven_repository/index.html#create-maven-packages-with-gitlab-cicd for instructions.";
fi
- 'mvn validate'
- 'mvn $MAVEN_CLI_OPTS install --settings ci_settings.xml'
- 'mvn $MAVEN_CLI_OPTS deploy --settings ci_settings.xml'
only:
variables:
- $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
Is there anything specific for Gitlab CI to be configured with bnd-maven-plugin to work as expected wrt Export-Package versions?