Gradle 2.7 GoogleTest plugin cannot be combined with the legacy Java plugin

I use Gradle 2.7 for native C++ project that also utilizes the thrift plugin by Thomas Lee

This plugin has a dependency on the legacy Java plugin but in my case I only need to build C++ generated Thrift files. As a result the combination of the Thrift plugin in my C++ project brings the legacy Java plugin in the model. It seems the result is a task graph issue manifesting itself early in the configuration cycle as this error:
FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project ‘google-test’.

Exception thrown while executing model rule: NativeBinariesTestPlugin.Rules#attachBinariesToCheckLifecycle
Cannot add rule NativeBinariesTestPlugin.Rules#attachBinariesToCheckLifecycle > named(check) for model element ‘tasks.check’ at state Initialized as this element is already at state GraphClosed.

This error was captured from the google-test example just by adding apply plugin: “java” at the top.

I am considering refactoring the Thrift plugin to not rely on the Java plugin when there is only C++ generators defined or rewriting it to use the Rules plugin model.

I am also concerned that this may be a broader issue with the interactions in the legacy plugins and the new rules model.


Alex Volanis

I think you’re running into Plugin google-test causes failure when plugin java is applied

Fixing this and allowing legacy/rule plugins to be mixed together is something we need to address.