0

I use the jsonschema2pojo Maven plugin and have a question about the generated target package structure and where classes end up.

The folder structure I have for the JSON schema files is the following:

specifications
|- A
|- B
|- C
|- components
|- some other files and folders I don't want to include

In components I have schemas that are used only as $refs in the other folders - sometimes only in one file in one folder, sometimes in several files in different folders.

The configuration looks like this:

<plugin>
    <groupId>org.jsonschema2pojo</groupId>
    <artifactId>jsonschema2pojo-maven-plugin</artifactId>
    <version>1.2.1</version>
    <configuration>
        <sourceDirectory>${basedir}/../../../specifications</sourceDirectory>
        <includes>
            <include>components</include>
            <include>A</include>
            <include>B</include>
            <include>C</include>
        </includes>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
        </execution>
    </executions>
</plugin>

The plugin generates classes for all JSON files, and it creates a target package structure that's just like the input structure:

target package
|- A
|- B
|- C
|- components

Some JSON files from the components folder become classes in the components target package. However, some end up in the other target packages (A, B, or C). I can't figure out how it decides where to put them, it doesn't look systematic.

I actually would like to have them all in the components target package, but I'd be happy already to understand it.

I also tried to exclude everything I don't want, instead of including the folders I want, but the result is the same.

Any hints?

0 Answers0