gpt4 book ai didi

json - 如何在 maven 的 POM 中更改由 jsonschema2pojo 生成的默认 OutputSchema.java 类名

转载 作者:行者123 更新时间:2023-12-04 16:04:56 31 4
gpt4 key购买 nike

在线工具http://www.jsonschema2pojo.org/有一个设置类名的选项,因此生成的根类将根据我的需要命名。我无法在 maven-plugin 选项中找到相同的选项,并且生成的根类具有默认名称:OutputSchema.java有没有办法设置它?我的 pom.xml

            <plugin>
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
<version>0.5.1</version>
<configuration>
<sourceDirectory>${basedir}/src/main/resources/schema</sourceDirectory>
<outputDirectory>${basedir}/src/main/java</outputDirectory>
<targetPackage>com.test.generated</targetPackage>
<targetVersion>1.8</targetVersion>
<sourceType>json</sourceType>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>

最佳答案

注意还有一个选项叫做

<useTitleAsClassname>true</useTitleAsClassname>

如果您使用它,类名将是您在架构的标题属性中指定的名称。

https://github.com/joelittlejohn/jsonschema2pojo/issues/908

关于json - 如何在 maven 的 POM 中更改由 jsonschema2pojo 生成的默认 OutputSchema.java 类名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49179756/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com