Giter VIP home page Giter VIP logo

Comments (5)

stigkj avatar stigkj commented on July 18, 2024

I've been meaning to add a convention object, but time has not allowed it. Think it would be easy to add just to be able to change the schemaDir. Not sure how it would work with the dynamic nature of the source sets.

JaxbSourceDirectory is not a normal plugin convention as one is created for each source set. So it is more a convention object for each JAXB source drectory set. So a plugin convention would be a new object :-)

Good point about changing the default from jaxb to xsd. A little narrowminded of me. That, at least, is a very easy fix.

from gradle-jaxb-plugin.

mraccola avatar mraccola commented on July 18, 2024

I have been able to work around the issue by adding this code to my build:

project.convention.plugins.java.sourceSets.all { SourceSet sourceSet -> sourceSet.jaxb { srcDir 'src/main/xsd' } }

Maybe something like this be nice to have?

sourceSets { main { xsd { srcDir 'src/main/xsd' } } }

from gradle-jaxb-plugin.

stigkj avatar stigkj commented on July 18, 2024

I'm afraid your sourceSets.all thing only works when you only have schemas in the main source directory set. An example:

sourceSets {
    main {
        ...
    }
    customer1 {
        ...
    }
    customer2 {
        ...
    }
}

Here you have 3 source sets which normally has 3 schema source directory sets:

src/main/jaxb
src/customer1/jaxb
src/customer2/jaxb

If you had applied your sourceSets.all thing on such a project, you would only get 1 source directory (src/main/xsd)
for all source sets, which was not your intention, I would guess.

But you can actually change the directory properly for multiple source sets with the current version of the plugin, just like what
you have done in the second block, but with jaxb as the source directory set name instead of xsd:

sourceSets {
    main {
        jaxb { srcDir 'src/main/xsd' }
    }
    customer1 {
        jaxb { srcDir 'src/customer1/xsd' }
    }
    customer2 {
        jaxb { srcDir 'src/customer2/xsd' }
    }
}

So when this issue is closed, the previous code block will be the standard setup, that is, the directory for the schemas will be
src/<source set name>/xsd

from gradle-jaxb-plugin.

stigkj avatar stigkj commented on July 18, 2024

Regarding your wish for this:

sourceSets {
    main {
        xsd { <some overrides> }
    }
}

I think this is better:

sourceSets {
    main {
        jaxb { <some overrides> }
    }
}

As it is a source directory set for the JAXB plugin, it is better to name it jaxb than xsd.

from gradle-jaxb-plugin.

stigkj avatar stigkj commented on July 18, 2024

Changing the default source directory to .../xsd is moved into its own issue.

Then the rest of this issue is solved by using the options available in source sets as shown in previous comments.

from gradle-jaxb-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.