Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle plugin: ability to set the sourceset to which generated files are added #1600

Open
Fabilin opened this issue Apr 15, 2024 · 1 comment

Comments

@Fabilin
Copy link

Fabilin commented Apr 15, 2024

The jsonschema2pojo gradle plugin automatically attaches the generated files to the main sourceset of a project. However, some projects may wish to add generated sources to a separate sourceset, or even to generate them without using them as sources at all. As such, it would be helpful to add a (nullable) sourceSet variable to the plugin's configuration, which could default to the main sourceset.

@sermarr
Copy link

sermarr commented Jul 8, 2024

I think the maven plugin has 'addCompileSourceRoot' you can set to false and not add targetDirectory to the sources in the first place but the gradle one doesn't (or does it?).

I do the generation on one module (A) but set the targetDir to another (B) and get "Duplicate content root detected" warnings on InteliJ, .. but with Visual Studio Code's Java plugin... it gets messed up totally and shows red squiggly lines everywhere. .. because it added module B's generated source to module A

My workaround is keep the generated files in module A, create another task in module A that copies the contents of targetDirectory (in A) to module B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants