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

**URL:** <https://discuss.gradle.org/t/declaring-custom-build-task-when-using-the-standard-gradle-lifecycle-plugins-is-not-allowed/27889>\
**Category:** Help/Discuss\
**Tags:** plugins\
**Created:** [July 25, 2018, 2:22am UTC](https://discuss.gradle.org/t/declaring-custom-build-task-when-using-the-standard-gradle-lifecycle-plugins-is-not-allowed/27889 "2018-07-25T02:22:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aver\_Mimas](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@Aver\_Mimas](https://discuss.gradle.org/u/Aver_Mimas)\
**Post date:** [July 25, 2018, 2:22am UTC](https://discuss.gradle.org/t/declaring-custom-build-task-when-using-the-standard-gradle-lifecycle-plugins-is-not-allowed/27889/1 "2018-07-25T02:22:54Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Chris\_Dore](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/chris_dore/32/7592_2.png) [@Chris\_Dore](https://discuss.gradle.org/u/Chris_Dore)\
**Post date:** [July 25, 2018, 4:26am UTC](https://discuss.gradle.org/t/declaring-custom-build-task-when-using-the-standard-gradle-lifecycle-plugins-is-not-allowed/27889/2 "2018-07-25T04:26:00Z")

</div>

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](https://github.com/gogradle/gogradle/issues/164)

---

<div class="post-metadata">

**Author:** ![Aver\_Mimas](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@Aver\_Mimas](https://discuss.gradle.org/u/Aver_Mimas)\
**Post date:** [July 25, 2018, 2:38pm UTC](https://discuss.gradle.org/t/declaring-custom-build-task-when-using-the-standard-gradle-lifecycle-plugins-is-not-allowed/27889/3 "2018-07-25T14:38:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Aver\_Mimas](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@Aver\_Mimas](https://discuss.gradle.org/u/Aver_Mimas)\
**Post date:** [July 25, 2018, 8:00pm UTC](https://discuss.gradle.org/t/declaring-custom-build-task-when-using-the-standard-gradle-lifecycle-plugins-is-not-allowed/27889/4 "2018-07-25T20:00:08Z")

</div>

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.

> <https://github.com/gogradle/gogradle/blob/master/docs/tasks.md#task-name-conflict>

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`.
