I am trying to use semantic-release within a GitLab CI pipeline. I have the prepare stage working fine, but the publish stage always fails when I use anything other than mvn jar:jar deploy:deploy
, but when i use those commands it deploys a jar that is 3kb big instead of a jar that is 10mb. So i can only assume that it is not gathering dependencies. There was a WARNING
message about no files being marked for inclusion and the jar being empty. So I tried to package the project before calling deploy. It did not work.
The pipeline fails with no reason as to why. It just show that line as the culprit.
commands I have tried:
mvn clean install
mvn clean package deploy
mvn jar:jar deploy:deploy
mvn clean deploy:deploy
.. you get the idea.
Here is the prepare section that works:
verifyConditions:
- "@semantic-release/changelog"
- "@semantic-release/gitlab"
- "@semantic-release/git"
verifyRelease:
- path: "@semantic-release/exec"
cmd: echo -e "VERSION=${nextRelease.version}\nNEW_RELEASE=true" > RELEASE.env
prepare:
- path: "@semantic-release/exec"
cmd: if [ ! -d ".m2" ]; then mkdir .m2; cd .m2; touch settings.xml; echo $MVN_SETTINGS | base64 -d > 'settings.xml'; cd ..; fi; mvn versions:set -DnewVersion=${nextRelease.version} -B -gs .m2/settings.xml;
- "@semantic-release/changelog"
And here is the publish section that only works with jar:jar deploy:deploy but does not create the correct jar.
publish:
- "@semantic-release/gitlab"
- path: "@semantic-release/exec"
cmd: if [ ! -d ".m2" ]; then mkdir .m2; cd .m2; touch settings.xml; echo $MVN_SETTINGS | base64 -d > 'settings.xml'; cd ..; fi; mvn versions:set -DnewVersion=${nextRelease.version} -DremoveSnapshot=true clean deploy -B -gs .m2/settings.xml;
I'm extremely new to this, and I cannot see why:
1) trying clean deploy
is causing this to fail and jar:jar deploy:deploy
doesn't
2) how I can get semantic-release to create a jar with all dependencies for upload to our repository.
I should note that both Maven Shade plugin and Maven Deploy plugin are present in my pom.
This is an older run, but they all are formatted like this and tell you nothing about WHY it failed. Just that it did:
stderr: '/bin/sh: line 1: 425 Killed mvn clean deploy -B -gs .m2/settings.xml\n',
failed: true,
signal: null,
cmd: '/bin/sh -c mvn $MAVEN_CLI_OPTS versions:set -DremoveSnapshot; mvn clean deploy -B -gs .m2/settings.xml',
timedOut: false,
killed: false,
pluginName: '@semantic-release/exec' }ERROR: Job failed: command terminated with exit code 1