Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-19941

Gradle Plugin: Add Support For Downstream Dependencies

    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Major Major
    • gradle-plugin
    • None

      The Jenkins gradle plugin does not automatically trigger builds of downstream dependencies.

      For example. Say we have projects a, b, and c where c depends on b and b depends on a.

      If I build a, the gradle plugin should automatically build project b, and then automatically build project c.

      This information could be gleaned through the generation of a dependency graph using the dependencies section of each build.xml.

      Of course these dependencies can be configured in Jenkins manually, but that adds a lot of manual intervention for something that should be automatic.

          [JENKINS-19941] Gradle Plugin: Add Support For Downstream Dependencies

          Christian Galsterer added a comment - - edited

          I have started to implement support for this and have a prototype already working.
          My current ideas about this new feature are as follows:

          Phase 1:

          • Use Gradle Tooling API to get access to Gradle configuration and dependency information (done)
          • Find Maven projects as dependencies (almost done)
          • Find other Gradle project as dependencies (open)
          • Keep plugin as much untouched as possible, especially stay with the concept that Gradle support is implemented as a "Builder".

          Phase 2:

          • Consider new build type "Gradle build" to provide more integrated support for Gradle in Jenkins. This is for sure a topic on its own and needs definitely more discussions, but while implementing the downstream dependency support I have the impression that this would ease some items.

          Christian Galsterer added a comment - - edited I have started to implement support for this and have a prototype already working. My current ideas about this new feature are as follows: Phase 1: Use Gradle Tooling API to get access to Gradle configuration and dependency information (done) Find Maven projects as dependencies (almost done) Find other Gradle project as dependencies (open) Keep plugin as much untouched as possible, especially stay with the concept that Gradle support is implemented as a "Builder". Phase 2: Consider new build type "Gradle build" to provide more integrated support for Gradle in Jenkins. This is for sure a topic on its own and needs definitely more discussions, but while implementing the downstream dependency support I have the impression that this would ease some items.

          ASD added a comment -

          Thanks Christian for implementing this. It will really help. Some notes about how we are using Jenkins fwiw:

          1 - All of our projects are "free-style software projects." With the Jenkins Gradle plugin installed, this provides an optional Gradle "Build Step" for any project. We add this build step to each project. Within this build step would be a good place to provide a checkbox that says "Automatically build downstream dependencies". This way the support would be optional.

          2 - Our projects are multi-module. In the root-level build.gradle we have a version number defined. In the sub projects we apply from ../build.gradle and depend on compile: $coords + 'artifact' + $ver. ($coords and $ver being defined in ../build.gradle). I don't think this should affect the plugin though since you are getting the dependency information directly from Gradle which correctly resolves the variables for the artifact.

          3 - All of our dependencies are resolved using the gradle maven plugin from an artifact repository (Nexus).

          ASD added a comment - Thanks Christian for implementing this. It will really help. Some notes about how we are using Jenkins fwiw: 1 - All of our projects are "free-style software projects." With the Jenkins Gradle plugin installed, this provides an optional Gradle "Build Step" for any project. We add this build step to each project. Within this build step would be a good place to provide a checkbox that says "Automatically build downstream dependencies". This way the support would be optional. 2 - Our projects are multi-module. In the root-level build.gradle we have a version number defined. In the sub projects we apply from ../build.gradle and depend on compile: $coords + 'artifact' + $ver. ($coords and $ver being defined in ../build.gradle). I don't think this should affect the plugin though since you are getting the dependency information directly from Gradle which correctly resolves the variables for the artifact. 3 - All of our dependencies are resolved using the gradle maven plugin from an artifact repository (Nexus).

          In my opinion, looking for mapping jobs from Gradle dependencies and trigger a build for matching jobs is a wrong way. Gradle plugin must not be in charge of this schenario. It has to be delegated to another component with a in-memory graph.

          Gregory Boissinot added a comment - In my opinion, looking for mapping jobs from Gradle dependencies and trigger a build for matching jobs is a wrong way. Gradle plugin must not be in charge of this schenario. It has to be delegated to another component with a in-memory graph.

          Unfortunately I'm currently don't have as much time as hoped and therefore have to suspend the contribution on this item. If somebody has time and interest please feel free to take over.

          Christian Galsterer added a comment - Unfortunately I'm currently don't have as much time as hoped and therefore have to suspend the contribution on this item. If somebody has time and interest please feel free to take over.

          Jesus Zazueta added a comment -

          Hi. It's now 2017. Has there been any change? Are there any new ideas on how to tackle this problem? Thanks!

          Jesus Zazueta added a comment - Hi. It's now 2017. Has there been any change? Are there any new ideas on how to tackle this problem? Thanks!

          Stephan Krull added a comment -

          Have a look at https://plugins.jenkins.io/maven-plugin where this logic has been implemented long time ago for Maven.

          Stephan Krull added a comment - Have a look at https://plugins.jenkins.io/maven-plugin where this logic has been implemented long time ago for Maven .

          Any news on this topic ? Nobody uses gradle with Jenkins ? Or any workaround idea ?

          Alexis Morillo added a comment - Any news on this topic ? Nobody uses gradle with Jenkins ? Or any workaround idea ?

            jjzazuet Jesus Zazueta
            asd ASD
            Votes:
            3 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated: