Gradle plugins causing runtime jars not found error


(Vens L) #1

I have written a plugin that needs this jar:
org.codehaus.jackson:jackson-mapper-asl:1.9.13

I have added the following line in dependencies section:
compile ‘compile ‘org.codehaus.jackson:jackson-mapper-asl:1.9.13’’

This compiles and generates the correct jar.

Now, in my other project i say
apply-plugin ‘foobar’

Then, when I do a ./gradlew clean
I get the following error
Caused by: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper

Then, I added a foobar.gradle in the same dir as build.gradle and add the above jar as a runtime dependency and included the foobar.gradle like this:
apply-from : ‘foobar.gradle’

Now, I get the following error:
Caused by: org.gradle.api.internal.MissingMethodException: Could not find method runtime() for arguments [org.codehaus.jackson:jackson-mapper-asl:1.9.13] on org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler_Decorated@158ae284

What steps am I missing to have the runtime jars in the project that uses the foobar plugin?

Thanks