0

We have one Java/Spring Boot/React project hosted on GitLab. After initial development we decided to move to Azure DevOps. Project structure hosted on the GitLab and in local folder structure is simple:

-- Parent project (parent folder)
------- First Spring Boot Project (built with Maven, produces JAR1)
------- Second Spring Boot Project (built with Maven, uses JAR1 as dependency, produces JAR2)
------- React project (built with NPM, produces static pages)

I need to setup separate build process for React and for Spring 1 and 2 projects. In Azure DevOps there is selector for build from specific branch but I don't see how can I set pipelines to build project from specific folder?

Nenad Bulatović
  • 7,238
  • 14
  • 83
  • 113
  • Why are they in the same git repository, but you want to build them separately? – J Fabian Meier Sep 27 '20 at 18:31
  • @JFabianMeier Because Spring Boot is built with Maven and React with NodeJS, so I need two separate pipelines. Also, for Project 1 and Project 2 has to be build before Parent Project. Why all those projects are in same Git repository? To avoid common mistake that developer commit backend part but forget front end or vice versus. Also keeps all dependencies in same repository makes it easier for maintenance. – Nenad Bulatović Sep 27 '20 at 19:40
  • @JFabianMeier Something like this, but for Azure DevOps https://stackoverflow.com/questions/41182186/jenkins-pipeline-with-folder-plugin-how-to-build-a-job-located-different-folder – Nenad Bulatović Sep 27 '20 at 19:52
  • Please check if the several answers below can resolve your issue. Feel free to let me know if you're still blocked, I'll try my best to help. – Walter Oct 02 '20 at 09:55

2 Answers2

1

You have path filter:

# specific path build
trigger:
  branches:
    include:
    - master
    - releases/*
  paths:
    include:
    - docs/*
    exclude:
    - docs/README.md

Please check documentation here

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
1
  1. When you use Maven task to build your Spring Boot Project, you need to specify the path to your pom.xml file by changing the value of Maven POM file field. The file path value should be relative to the root of the repository, such as IdentityService/pom.xml or $(system.defaultWorkingDirectory)/IdentityService/pom.xml. Here is the document about Maven task.
  2. When you use npm task to build your React project, you can set the working folder that contains package.json. Please select the folder instead of the file when you set the working folder. Here is the document about npm task.

In addition, you may also need to set path filters in Continuous integration (CI) triggers. Here is the document about CI Triggers.

Walter
  • 2,640
  • 1
  • 5
  • 11