xmlbeans - Gradle plugin for XML Beans -


i trying write gradle plugin xml beans. have started 1 of 'hello gradle' plugin examples, , plugin published r. artavia here. plugin went straight jar - trying generate source. generated source must compiled other project source , included in single jar. other goals include - full plugin - should need "apply plugin: 'xmlbean'" - can configure source/code gen location , features if want - detects whether needs rebuilt. (well, eventually!!!)

i off pretty start, blocked defining new sourceset. getting error "no such property 'srcdirs'" (or 'srcdir'). seems there have define someplace make new sourceset work cannot find it. have tried several different syntaxes (with/without equal sign, brackets, srcdir/srcdirs, etc. - nothing working...

what need inside plugin make new sourceset entry recognized?

thank you! jke

file: xmlbean.gradle (includes greeting plugin moment debugging)

apply plugin: xmlbean apply plugin: 'java'  xmlbean {   message = 'hi'   greeter = 'gradle' }  class xmlbean implements plugin<project> {    void apply(project project) {      project.extensions.create("xmlbean", xmlbeanextension)     task xmlbeantask = project.task('xmlbean')     xmlbeantask << {        project.configurations {         xmlbeans       }        project.dependencies {         xmlbeans 'org.apache.xmlbeans:xmlbeans:2.5.0'       }        project.sourcesets {         main {           java {             srcdirs += '$project.builddir/generated-source/xmlbeans'           }         }         xmlbeans {           srcdirs = ['src/main/xsd']         }       }        ant.taskdef(name: 'xmlbean',                   classname: 'org.apache.xmlbeans.impl.tool.xmlbean',                   classpath: project.configurations.xmlbeans.aspath)       ant.xmlbean(schema: project.sourcesets.xmlbean.srcdir,                   srconly: true,                   srcgendir: "$project.builddir/generated-sources/xmlbeans",                   classpath: project.configurations.xmlbeans.aspath)        println "${project.xmlbean.message} ${project.xmlbean.greeter}"     }     project.compilejava.dependson(xmlbeantask)   } }  class xmlbeanextension {   string message   string greeter } 

file: build.gradle

apply from: '../gradle/xmlbeans.gradle'  dependencies {   compile "xalan:xalan:$ver_xalan",           ":viz-common:0.0.1",           ":uform-repository:0.1.0" } 

console: error message:

:idk:xmlbean failed  failure: build failed exception.  * where: script 'c:\jdev\cpc-maven\try.g2\comotion\gradle\xmlbeans.gradle' line: 32  * went wrong: execution failed task ':idk:xmlbean'. > no such property: srcdirs class: org.gradle.api.internal.tasks.defaultsourceset_decorated ... build failed 

gradle info: version 2.5 / groovy 2.3.10 / jvm 7u55 on windows 7 amd64

you should try become familiar gradle dsl reference guide, because it's huge in situations this. example, if click on sourcesets { } link in left navigation bar, you're taken this section on source sets.

from there, you'll discover sourcesets {} block backed class, sourcesetcontainer. next level of configuration nested inside backed sourceset object, , within have 1 or more sourcedirectoryset configurations. when follow link sourcedirectoryset, you'll see there getsrcdirs() , setsrcdirs() methods.

so how help? if closely @ exception, you'll see gradle saying can't find srcdirs property on defaultsourceset_decorated, can infer instance of sourceset. interface not have srcdirs property. that's because xmlbeans {} block configuring sourceset, not sourcedirectoryset. need add nested configuration gain access srcdirs.

at point, i'm wondering whether new source set appropriate solution. unfortunately it's not clear me plugin should doing, can't offer alternatives @ point.


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -