I believe I am missing something but gradle gives an error. Tried with Test
task and gave the same error:
* What went wrong:
A problem occurred evaluating project ':app'.
Cause: Could not find method add() for arguments [unitTestJar, class
org.gradle.
api.tasks.bundling.Jar,
lv.ctco.scm.cs.libraryplugin$_librarybuild_closu...@1e35
ecd] on task container.
My plugin:
project.sourceSets {
unitTest {
compileClasspath = project.sourceSets.main.classes +
project.configurations.compile +
project.configurations.testCompile
runtimeClasspath = project.sourceSets.unitTest.classes +
project.sourceSets.main.classes +
project.configurations.compile +
project.configurations.testRuntime
}
}
project.tasks.add('unitTestJar', Jar){
from project.sourceSets.unitTest.classes
}
Narco wrote:
>
> I`m trying to reuse this example:
> build.gradle
>
> task intTestJar(type: Jar) {
> from sourceSets.intTest.classes
> }
>
>
> I`m trying to do it from custom plugin so I have:
>
> public class LibraryPlugin implements Plugin {
> ...
> def void use (Project project, ProjectPluginsContainer
> projectPluginsHandler){
> project.usePlugin('java')
> ...
> project.task unitTestJar(type: Jar) {
> from project.sourceSets.unitTest.classes
> }
> }
> ...
> }
>
>
> The gradle throws exception on evaluating:
> * What went wrong:
> A problem occurred evaluating project ':app'.
> Cause: No signature of method: lv.ctco.scm.cs.LibraryPlugin.unitTestJar()
> is app
> licable for argument types: (java.util.LinkedHashMap,
> lv.ctco.scm.cs.LibraryPlug
> in$_LibraryBuild_closure3) values: [[type:class
> org.gradle.api.tasks.bundling.Ja
> r], lv.ctco.scm.cs.libraryplugin$_librarybuild_closu...@10948cf]
>
> How to reuse task type of other plugin?
>
--
View this message in context:
http://old.nabble.com/Assembling-a-JAR-for-a-custom-source-set-tp26130892p26156651.html
Sent from the gradle-user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email