How to build dependent projects using Bit Bucket pipeline

荒凉一梦 提交于 2020-01-16 10:30:17

问题


I am trying to get my build working with pipeline using maven . I have two bit bucket repositories for two maven projects. repository1 -> project1 repository2 -> project2. project2 has dependency on project1. Now I dont have problem in building project1 as it doesn't has dependency on any projects. But when I try to build project2 using pipeline build is failing because maven is not finding the project1 artifact.

I got to know that every pipeline runs within a docker image. So my guess is that pipelines for project1 and project2 are running in 2 separate docker images. Because of this when I run pipeline for project2 maven is not finding project1 artifact in local repository. One way to fix this is hosting a maven remote repo for my project artifacts and adding the repo in POM of project2. But i don't want to host a maven repo. I want maven to pick the artifact from local repo. How to get this working?


回答1:


I'm sorry that no one ever answered this question for you. Setting up BitBucket Pipelines to use private maven repositories requires you to create a custom settings.xml file in the pipeline and then invoking maven with that file specified.

You can't just put a settings.xml file in your source code repository as it would put your credentials at risk. Instead, you can create a settings.xml file and set credentials from BitBucket Pipelines Secure environment variables.

It's pretty straightforward once you see it in action. I actually wrote an extensive guide on how to completely setup BitBucket Pipelines with Maven repositories that shows specifically how to do this in a secure manner.



来源:https://stackoverflow.com/questions/46504651/how-to-build-dependent-projects-using-bit-bucket-pipeline

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!