Gradle 1.7-rc-1: IDEA plugin doesn't work

(Chris Jones) #1

I have a custom plugin in buildSrc. That plugin includes this line:

project.apply(plugin: 'idea')

When running with Gradle-1.7-rc-1, in a Scala-using subproject, I get this error:

> Could not find property 'ideaProject' on task set.

This works fine with 1.6.

(Peter Niederwieser) #2

Did you do a clean build after switching Gradle versions? (That’s required.)

(Chris Jones) #3

Sorry for the slow reply. Yes, I just tried this: 1. gradlew clean 2. Edit gradle/wrapper/ to set 1.7-rc-1 3. gradlew clean

…same result.

(Peter Niederwieser) #4

To my knowledge, no changes were made to the IDEA and Scala plugins for 1.7. The problem you are describing might be a symptom of another problem, either with Gradle or with your plugin/build script. To investigate further, I’d need a way to reproduce this.

(Chris Jones) #5

This code was added to configureForScalaPlugin() in IdeaPlugin.groovy between 1.6 and 1.7-rc-1:

project.plugins.withType(ScalaBasePlugin) {
            //see IdeaScalaConfigurer

I can’t give you access to this project, but I can show you the stack trace:

Caused by: groovy.lang.MissingPropertyException: Could not find property 'ideaProject' on task set.
 at org.gradle.api.internal.AbstractDynamicObject.propertyMissingException(
 at org.gradle.api.internal.AbstractDynamicObject.getProperty(
 at org.gradle.api.internal.CompositeDynamicObject.getProperty(
 at org.gradle.api.internal.tasks.DefaultTaskContainer_Decorated.getProperty(Unknown Source)
 at org.gradle.plugins.ide.idea.IdeaPlugin$_configureForScalaPlugin_closure8.doCall(IdeaPlugin.groovy:179)
 at org.gradle.api.internal.ClosureBackedAction.execute(
 at org.gradle.api.internal.Actions$FilteredAction.execute(
 at org.gradle.api.internal.DefaultDomainObjectCollection.all(
 at org.gradle.api.internal.DefaultDomainObjectCollection.all(
 at org.gradle.api.internal.DefaultDomainObjectCollection.withType(
 at org.gradle.api.DomainObjectCollection$ Source)
 at org.gradle.plugins.ide.idea.IdeaPlugin.configureForScalaPlugin(IdeaPlugin.groovy:177)
 at org.gradle.plugins.ide.idea.IdeaPlugin.onApply(IdeaPlugin.groovy:60)
 at org.gradle.plugins.ide.internal.IdePlugin.apply(IdePlugin.groovy:37)
 at org.gradle.plugins.ide.internal.IdePlugin.apply(IdePlugin.groovy)

It looks like it now requires the idea plugin to be applied to the root project. In my case, the root project doesn’t have any code in it.

(Peter Niederwieser) #6

The IDEA and Eclipse plugins expect that they are always being applied to the root project, no matter if it contains code or not (typically it doesn’t). This is especially important for Scala because the Scala compiler(s) to be used can only be declared in the ‘.ipr’ file.