Declaring custom 'build' task when using the standard Gradle lifecycle plugins is not allowed

plugins

(Aver Mimas) #1

Hi,

I am currently getting the following error in one of my project’s build from the CI server.

* What went wrong:
An exception occurred applying plugin request [id: 'com.github.blindpirate.gogradle', version: '0.8.0']
> Failed to apply plugin [id 'com.github.blindpirate.gogradle']
   > Declaring custom 'build' task when using the standard Gradle lifecycle plugins is not allowed.

This project has not changed. The last time it was built successfully was about 1 month ago. What I don’t understand is that why is this error coming up now suddenly. There was no change in the Gradle build script and there wasn’t any update to Gradle version either.

Gradle version: 4.4
Applied plugins:

  • base
  • groovy
  • id ‘com.github.blindpirate.gogradle’ version ‘0.8.0’
  • id ‘org.unbroken-dome.test-sets’ version ‘1.4.2’

The CI build servers are RedHat based Linux machine. The build is failing consistently on all machines. When I tried to run the same build using Gradle Wrapper from that project on my Mac, I don’t have that error.

I can’t seem to explain what is causing this failure. Any ideas?


(Chris Doré) #2

I don’t have a direct answer about why the sudden change in behaviour, but here’s a related issue https://github.com/gogradle/gogradle/issues/164


(Aver Mimas) #3

Thanks @Chris_Dore. I tried to apply whatever worked for the original poster in that issue, but that didn’t work for me. I’ve never had an issue with Gradle build like this before where it suddenly starts to behave differently.


(Aver Mimas) #4

Finally figured out what the problem is.

The project has a gradle.properties file that contained org.gradle.jvmargs property for setting an alias for the task names of the gogradle plugin.

The CI build servers had recently changed. The build servers now has a global gradle.properties file that contains the same property (org.gradle.jvmargs). As a result, Gradle build was using values defined in the global properties file, which means the task name alias for that plugin was not being set. And because of that there were multiple tasks named build and Gradle started to complain.

Had to make sure the necessary properties are set. In this case, set the required property through command line option -Dgogradle.alias=true.