maven使用插件利用json生成javabean

使用如下样例代码,注意json文件位置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<plugin>
<groupId>org.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
<version>0.4.30</version>
<executions>
<execution>
<id>execution1</id>
<phase>generate-sources</phase>
<configuration>
<sourcePaths>
<sourcePath>${basedir}/schema/settings.json</sourcePath>
<sourcePath>${basedir}/schema/stuStaticInfos.json</sourcePath>
<sourcePath>${basedir}/schema/gradeInfo.json</sourcePath>
</sourcePaths>
<targetPackage>com.hqjl.classify.input.model</targetPackage>
<sourceType>json</sourceType>
<serializable>false</serializable>
<classNameSuffix>Model</classNameSuffix>
<generateBuilders>true</generateBuilders>
</configuration>
<goals>
<goal>generate</goal>
</goals>
</execution>
<execution>
<id>execution2</id>
<phase>generate-sources</phase>
<configuration>
<sourcePaths>
<sourcePath>${basedir}/schema/results.json</sourcePath>
</sourcePaths>
<targetPackage>com.hqjl.classify.result.model</targetPackage>
<sourceType>json</sourceType>
<serializable>false</serializable>
<classNameSuffix>Model</classNameSuffix>
<generateBuilders>true</generateBuilders>
</configuration>
<goals>
<goal>generate</goal>
</goals>
</execution>
<execution>
<id>execution3</id>
<phase>generate-sources</phase>
<configuration>
<sourcePaths>
<sourcePath>${basedir}/schema/actionId.json</sourcePath>
</sourcePaths>
<targetPackage>com.hqjl.classify.request</targetPackage>
<sourceType>json</sourceType>
<serializable>false</serializable>
<classNameSuffix>Model</classNameSuffix>
<generateBuilders>true</generateBuilders>
</configuration>
<goals>
<goal>generate</goal>
</goals>
</execution>

</executions>

</plugin>