Gradle compileGroovy fails org/eclipse/core/runtime/Plugin dependency not found

My problem is if I move a custom task class defined build.gradle from lines 54 to 407 of

where compileGroovy works into a custom class defined in java_stix/buildSrc/src/main/groovy/org/mitre/stix/

I’m getting

 gradle compileGroovy                                         
 To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: gradle.org/docs/2.3/userguide/gradle_daemon.html.
 :buildSrc:compileJava UP-TO-DATE
 :buildSrc:compileGroovy FAILED
 
 FAILURE: Build failed with an exception.
 
 * What went wrong:
 Execution failed for task ':compileGroovy'.
 > org/eclipse/core/runtime/Plugin

 * Try:
 Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
 
 BUILD FAILED

 Total time: 4.451 secs

I posted this problem to the previous forum and received a response from Luke directing me to move the custom task classes dependencies out of buildsript->dependencies straight into dependencies.

I had tried this earlier going against the advice of “Gradle in Action”, page 198, where it tells you to add the dependency for a custom task to the buildscript->dependencies as classpath entries versus adding them straight to dependency. Maybe conflicting later with page 204.

But I gave it another try, I moving

 classpath "org.eclipse.core:org.eclipse.core.runtime:3.10.0.v20140318-2214"
 classpath "org.eclipse:org.eclipse.osgi:3.10.0.v20140606-1445"
 classpath "org.eclipse.core:org.eclipse.core.contenttype:3.4.200.v20140207-1251"
 classpath "org.eclipse.equinox:org.eclipse.equinox.common:3.6.200.v20130402-1505"
 classpath "org.eclipse:org.eclipse.text:3.5.300.v20130515-1451"
 classpath "org.eclipse.core:org.eclipse.core.jobs:3.6.0.v20140424-0053"
 classpath "org.eclipse.equinox:org.eclipse.equinox.preferences:3.5.200.v20140224-1527"
 classpath "org.eclipse.core:org.eclipse.core.resources:3.9.0.v20140514-1307"
 classpath "org.eclipse.jdt:org.eclipse.jdt.core:3.10.0.v20140604-1726"
 classpath "org.eclipse.equinox:org.eclipse.equinox.registry:3.5.400.v20140428-1507"

out of buildscript -> dependencies

into

dependencies

changing classpath to compile for each line like so:

compile "org.eclipse.core:org.eclipse.core.runtime:3.10.0.v20140318-2214"
compile "org.eclipse:org.eclipse.osgi:3.10.0.v20140606-1445"
compile "org.eclipse.core:org.eclipse.core.contenttype:3.4.200.v20140207-1251"
compile "org.eclipse.equinox:org.eclipse.equinox.common:3.6.200.v20130402-1505"
compile "org.eclipse:org.eclipse.text:3.5.300.v20130515-1451"
compile "org.eclipse.core:org.eclipse.core.jobs:3.6.0.v20140424-0053"
compile "org.eclipse.equinox:org.eclipse.equinox.preferences:3.5.200.v20140224-1527"
compile "org.eclipse.core:org.eclipse.core.resources:3.9.0.v20140514-1307"
compile "org.eclipse.jdt:org.eclipse.jdt.core:3.10.0.v20140604-1726"
compile "org.eclipse.equinox:org.eclipse.equinox.registry:3.5.400.v20140428-1507"

adding

mavenLocal()

to

repositories

and I’m still getting

 gradle compileGroovy                                         
 To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: gradle.org/docs/2.3/userguide/gradle_daemon.html.
 :buildSrc:compileJava UP-TO-DATE
 :buildSrc:compileGroovy FAILED
 
 FAILURE: Build failed with an exception.
 
 * What went wrong:
 Execution failed for task ':compileGroovy'.
 > org/eclipse/core/runtime/Plugin

 * Try:
 Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
 
 BUILD FAILED

 Total time: 4.451 secs

The thing is the eclipse runtime plugin is a dependency of those classes imported into the task. So, my thought is it

What am I doing wrong?

-Michael

So if you have a thirdparty dependency in your buildSrc project/sources, you should declare those dependencies in buildSrc/build.gradle as you do in a normal groovy / java project. So I think the solution is to add a buildSrc/build.gradle file with a dependency to the lib who has org/eclipse/core/runtime/Plugin in it

Hmm. How does the project’s ./build.gradle fire off the ./buildSrc/build.gradle? Or how are they related?

I’m not saying what you are saying is wrong, but this isn’t tracking with what is documented

http://gradle.org/docs/current/userguide/custom_tasks.html

nor Gradle in Action, section 8.3 onward.

Check out the user guide section specifically dealing with the buildSrc project.

http://gradle.org/docs/current/userguide/organizing_build_logic.html#sec:build_sources

There seems to be truth to what you’re suggesting… the ./buildSrc/build.gradle gets fired off when I run the project’s build.gradle. I have hope… Working…

Ah… this is starting to click. Thank you.

Yep. I got it working.

For those who come behind I committed my code. Look for commits 36827cb72fe90bb65783d030e5a130aebea2c688 and 5878f05b442e89129175197590a89fddc4b26eb2.

Thanks guys!

-Michael