简体   繁体   中英

Jenkins builds with gradle subprojects

Is there anyway I can create a two module projects in gradle, and trigger a build for each module by itself?

Root project 'Example' 
    Jenkinsfile
\--- Project ':SubProject'
    Jenkinsfile

I want that jenkins will trigger a build only in the module that has been changed.


for example :

If my SubProject changed, then only SubProject will execute it's own Jenkinsfile .

I looked up for this option for a very long time...

As you can see in the other questions, there is no any easy way to achieve that.

Is there any Jenkins pipeline or plugin that can deal with that?

  • It is relatively easy to only invoke the gradle tasks from a given subproject:
    • To build Example : ./gradlew :build
    • To build SubProject : ./gradlew :SubProject:build
    • Gradle will then only run the task graph these invocation define.
  • It should be relatively easy to setup two different jobs in Jenkins, based on distinct Jenkinsfile, and each could have the custom invocation defined above.

However, the triggering of one project only will most likely be the tricky thing as they most likely live in the same source control location.

Maybe the easy fix is also to have them decoupled, using svn:externals or Git submodules.

Use excludedRegions to exclude folders/files that would trigger a build.

https://jenkins.io/doc/pipeline/steps/workflow-scm-step/

I'm unsure about the support of JenkinsFile...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM