[GRADLE-2253] Task eclipseClasspath fails with 'Cannot get property 'name' on null object' Created: 26/Apr/12  Updated: 04/Jan/13  Resolved: 30/Apr/12

Status: Resolved
Project: Gradle
Affects Version/s: 1.0-rc-1
Fix Version/s: None

Type: Bug
Reporter: Carlo Luib-Finetti Assignee: Unassigned
Resolution: Duplicate Votes: 0

Attachments: Zip Archive gradleTest.zip    


I have a multi project and tried to use eclipse-plugin and eclipse-wtp-plugin. On these task Gradle crashes with exceptions.

I tracked the problem down to the attached demo project. I further could track it down to my externalized library definitions in file 'libraries.gradle'. When I comment out the section "ext.eclipse = ", the task ':favbg.common:eclipseClasspath' works, but when I leave it active, Gradle fails with a Nullpointer. Curiously, this happens only to one of the subprojects in the attached demo project ("favbg.common"), but not on the other one ("de.uvdms.util").

Maybe I've done something bad, but I cannot figure it out.

(This issue results from the problems reported at 'http://forums.gradle.org/gradle/topics/failed_to_notify_action_cannot_invoke_method_containers_on_null_object')

Comment by Szczepan Faber [ 30/Apr/12 ]


Please avoid creating 'extra' properties with names that match existing DSL contributed by plugins/Gradle. For example, creating 'extra' property like 'dependencies', 'configurations' might get you into trouble. Similarly, the eclipse plugin contributes an 'eclipse' extension that provides DSL for configuring extra Eclipse stuff. When you do project.ext.eclipse=[] you create an extra property with the same name as the extension 'eclipse' and hence the problems.

On our end, we need better exception reporting (and failing fast) if someone adds an extra property that matches existing extension. Other way around, too. That is when someone adds 'eclipse' extension but there's already an 'eclipse' extra property.

Down the road will probably figure out better strategy of dealing with extension's name clashes.

I will close this issue and create a separate one that specifically tells about extension VS extra property name clash.

Comment by Szczepan Faber [ 30/Apr/12 ]

It is a specific instance of this problem: http://issues.gradle.org/browse/GRADLE-2259

Comment by Carlo Luib-Finetti [ 30/Apr/12 ]

Ok, thank you for investigations on my problem. I will keep you proposals in my mind, I hope.

And yes, if Gradle can be tuned to output better explaining error messages, it always will be a good thing.

Generated at Wed Jun 30 12:16:53 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.