AOEpeople / gradle-jenkins-job-dsl-plugin

Plugin for easy management of Jenkins Job DSL scripts with Gradle
MIT License
25 stars 12 forks source link

Support for Gradle 7 #25

Open yangchoo opened 2 years ago

yangchoo commented 2 years ago

This plugin currently fails to build when running on Gradle 7 due to

* What went wrong:
An exception occurred applying plugin request [id: 'com.aoe.jenkins-job-dsl', version: '2.9.0']
> Failed to apply plugin 'nebula.provided-base'.
   > No such property: COMPILE_CONFIGURATION_NAME for class: org.gradle.api.plugins.JavaPlugin

This may be resolvable by bumping the nebula plugin dependency

Geethree commented 2 years ago

@yangchoo ... did you solve this?

yangchoo commented 2 years ago

@Geethree No, didn't look deeper into this

fernandosandrade commented 2 years ago

error occurs because its dependends on gradle-extra 3.0.3:

https://plugins.gradle.org/m2/gradle-jenkins-job-dsl-plugin/jenkins-job-dsl-gradle-plugin/2.9.0/jenkins-job-dsl-gradle-plugin-2.9.0.pom

<dependency>
   <groupId>com.netflix.nebula</groupId>
   <artifactId>gradle-extra-configurations-plugin</artifactId>
   <version>3.0.3</version>
   <scope>runtime</scope>
 </dependency>

this dependecy tries to read COMPILE_CONFIGURATION_NAME from org.gradle.api.plugins.JavaPlugin which is deprecated in gradle 6 and removed in gradle 7.

solution is update the version of gradle-extra-configurations-plugin to most recently, which is compatible with gradle 7

https://github.com/nebula-plugins/gradle-extra-configurations-plugin/releases/tag/v7.0.0

xsaero00 commented 2 years ago

Following @fernandosandrade suggestion I was able to get past the error with the following:

 plugins {
    id 'com.aoe.jenkins-job-dsl' version '2.9.0'
    id "nebula.optional-base" version "7.0.0"
}

but then a new error showed up:

An exception occurred applying plugin request [id: 'com.aoe.jenkins-job-dsl', version: '2.9.0']
> Failed to apply plugin 'com.aoe.jenkins-job-dsl'.
   > Could not get unknown property 'compile' for configuration container of type org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.

I believe this is because the plugin is using compile configuration that was removed in Gradle 7 https://github.com/AOEpeople/gradle-jenkins-job-dsl-plugin/blob/1a935c309c8f9aeced8785685f70fffce5e988d7/jenkins-job-dsl-gradle-plugin/src/main/groovy/com/aoe/gradle/jenkinsjobdsl/JobDslPlugin.groovy#L190