How to generate pojo from json schema by maven
2017-03-12 17:12
288 查看
Generate json schema from json
you can generate json schema online through the following website.http://jsonschema.net/
Generate pojo by maven
Add the following maven configuration to your pom.xml, and execute maven command. you will find pojo generated by maven in your project.<properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <maven.compiler.encoding>UTF-8</maven.compiler.encoding> </properties> <dependencies> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.4</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.0.0</version> </dependency> </dependencies> <build> <testSourceDirectory>src/test/java</testSourceDirectory> <defaultGoal>install</defaultGoal> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> <encoding>UTF-8</encoding> </configuration> </plugin> <plugin> <groupId>org.jsonschema2pojo</groupId> <artifactId>jsonschema2pojo-maven-plugin</artifactId> <version>0.4.20</version> <configuration> <sourceDirectory>${basedir}/src/main/resources/schema</sourceDirectory> <targetPackage>com.example.types</targetPackage> </configuration> <executions> <execution> <goals> <goal>generate</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
Note: you need put your json schema in path ${basedir}/src/main/resources/schema.
you can visit website https://github.com/joelittlejohn/jsonschema2pojo for more information.
相关文章推荐
- How to remove Oracle Database from your computer---By Roger Gong
- How to remove Oracle Database from your computer---By Roger Gong
- How to remove Oracle Database from your computer---By Roger Gong
- How to Bind Silverlight DataGrid From IEnumerable of IDictionary by Transforming Each Dictionary Key
- How to remove Oracle Database from your computer---By Roger Gong
- How To Generate JSON With PHP and Parse It With JQuery
- How to create physical standby database with 11g RMAN DUPLICATE FROM ACTIVE DATABASE [ID 747250.1]
- How to create physical standby database with 11g RMAN DUPLICATE FROM ACTIVE DATABASE [ID 747250.1]
- How to export/import data with LOB type from one user/schema to another
- How to remove Oracle Database from your computer---By Roger Gong
- How to create physical standby database with 11g RMAN DUPLICATE FROM ACTIVE DATABASE [ID 747250.1]
- How to remove Oracle Database from your computer---By Roger Gong
- How to read images from drawable folder, not by R.drawable.[imageid]
- How to create physical standby database with 11g RMAN DUPLICATE FROM ACTIVE DATABASE [ID 747250.1]
- How to generate DLL files by GCC in the MinGW?
- How to remove Oracle Database from your computer---By Roger Gong
- How to create physical standby database with 11g RMAN DUPLICATE FROM ACTIVE DATABASE [ID 747250.1]
- How to merge from branches to trunk by TortoiseSVN
- How to add net.sf.json-lib dependendy in Maven