Migrating from Gradle M3 to M9, IDEA plugin problems

Hi Guys I know, a bit of a gap. But, I’m starting today and already bumped into some issues. So, this is how I go about the migration.

Downloaded Gradle M9, changed the path so there are new executables on it, and executed gradle clean in my project. A lot of deprecation messages (around dynamic properties) and then boom on IDEA plugin configuration. So I went to docs and I see differences.

So I changed to adapt to new ways and I got this:

idea.project {

jdkName = ‘1.6’

}

The warning I see is:

Dynamic properties have been deprecated (property “jdkName” on the object “project :foo” with value “1.6” created).

That is my first project in my multi-project build.

Then it bombs out on this:

idea.workspace.iws.withXml { provider->

// DO some funcky stuff

}

With this:

Cannot invoke method withXml() on null object.

What is going on? First the warning is a bit odd, and then the null object.

Cheers, Greg

Ps. Repo from mailing list

Can you post your full idea configuration block? This works fine for me with 1.0-m9.

idea.project {
    jdkName = '1.6'
      ipr.withXml { provider ->
       ...
    }

Hi Benjamin Sure:

idea {

module {

downloadSources = false

downloadJavadoc = false

iml {

whenMerged { module ->

// do the awesomness

}

}

}

project {

jdkName = ‘1.6’

}

workspace.iws.withXml { provider ->

// do more awesomness

}

}

Greg

I just put your code into a multi-module project of mine. It works fine for me (of course I unescaped the -> characters). Can you run a gradle -v to make sure you have the correct version?

I do have the correct version. Is there a possibility of caches clashing? Or some old M3 leftovers? Both installations are using same GRADLE_HOME.

It’s too bad we the Gradle Wrapper for m9 is not available yet on the public repository. That would certainly be helpful. Do you by any chance have your project sitting on a public?

It is available. You may have missed that the repo has changed.

http://services.gradle.org/distributions

Ah, I guess I must have executed it with an older milestone Gradle version which still pointed to the “old” dist repo (http://repo.gradle.org/gradle/distributions).

It is a pain that the old gradle’s don’t know about the new location, it requires you to tweak the wrapper.properties manually.

No, unfortunately it is not public. Would you elaborate more on the wrapper idea? How would it be helpful? Greg

Where did you put your apply plugin: ‘idea’ and idea {} configuration block? In allprojects {} ? I did put it in top level build.gradle (trunk) of my multi-project build file in allprojects section. Greg

If your project uses the wrapper, people can just check out the source and build your project without having to have Gradle installed and they are also guaranteed to use the version of Gradle that the build is written for.