I am attempting to create a shared pipeline template that can be referenced and used by our repositories. The template should be as flexible as possible to account for the different types of projects/modules. I have a "Java project build" step where it uses maven or gradle to build the project and at the end of the step, I want the build artifacts to be passed on to future steps.
script:
- ./mvnw -B clean verify
artifacts:
download: false # Do not download artifacts in this step
paths:
- "**/target/**"
The intention of the above step snippet is to build a maven project and then find all of the build artifacts for the maven project. Typically for maven projects, they would be in a "target" directory so this wild card "**/target/**" should be doing just that.
In practice, this does not seem to work for a project structure as such:
- .mvn/
- src/
- target/
- .gitignore
- bitbucket-pipelines.yml
- mvnw
- mvnw.cmd
- pom.xml
I expected the target directory and all of it's content to be captured in the pipeline run but is not.
This is one project use case but it should also find multi-module projects with multiple target directories.
Any help is appreciated.