I have a project that requires a jar to be built prior to the main application being built. I created a multi-step pipeline with the first step is to clone and install the first jar (its a private jar thats not available on the maven central repository). Everything worked fine until i tagged the required jar as a RELEASE. Now when i run the build it says it cant find the jar because its trying to reach out to the maven central repository for the file even though it was already built. The only way I was able to solve the problem was to combined the two steps into 1.
Here is the pipeline file I am using
pipelines:
default:
- step:
name: Commons build
image: maven:3.3.9
caches:
- maven
- node
script:
- git clone git@bitbucket.org:locus2k/commons.git --branch 1.1.0-RELEASE
- mvn -B install -f commons/pom.xml
artifacts:
- target/*.jar
- step:
name: Portal build
image: maven:3.3.9
size: 2x
caches:
- maven
- node
script:
- mvn -s pipeline-settings.xml -B install # -B batch mode makes Maven less verbose
services: - mysql
definitions:
services:
mysql:
image: mysql:8.0.11
environment:
MYSQL_DATABASE: 'portal'
MYSQL_ROOT_PASSWORD: 'let_me_in'
Is there anyway to specify the order in which the pipeline tries to find the jars? first locally then try to download it. I want to try to keep the two steps as they are and not combine them.
Hi @locus2k
Edit: My apologies I just saw that you're already using artifacts. I'll investigate this further and provide another recommendation.
Each step in Pipelines is a new environment. You can copy state from one step to another using artifacts. Please see the following page of our documentation for further information: https://confluence.atlassian.com/bitbucket/using-artifacts-in-steps-935389074.html
Regards
Sam
When using release artifacts maven first looks in the local .m2 directory and if not present it then checks the remote repository.
You're currently sharing the artifact from the target directory which the maven process in the second step will not use. You must copy the jar from target to the appropriate location under ~/.m2 in order for it to be found by the second step.
The reason this works when the steps are combined is because maven also installs dependencies in the local .m2 directory.
I hope this helps. For more information about maven's local repository please see the following references:
* https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.