问题
I have used the following URL to understand the usage of JsonSchema2Pojo plugin https://github.com/joelittlejohn/jsonschema2pojo/wiki/Getting-Started#the-maven-plugin
However, I am unable to generate any class for the address schema. I have followed the same step as mentioned in the source but still no java class has been generated for address schema. I don't understand what can I do now. Please help me with a proper explanation.
回答1:
Double check your pom.xml and your project setup. The instructions on the wiki worked for me, here are the steps I took (OSX)
Generate the initial project and pom.xml
mvn archetype:generate -DgroupId=com.stackoverflow.example -DartifactId=example -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
Download the address schema to ./src/main/resources/schema/address.json
Update the pom.xml as described on the JsonSchema2Pojo documentation
Generate the files
$ find . -type f ./pom.xml ./src/main/java/com/stackoverflow/example/App.java ./src/main/resources/schema/address.json ./src/test/java/com/stackoverflow/example/AppTest.java $ mvn package
Generated files will be under ./target/java-gen directory
$ find . -name Address.java ./target/java-gen/com/example/types/Address.java
来源:https://stackoverflow.com/questions/33146633/unable-to-generate-java-classes-from-json-schema-using-jsonschema2pojo-maven-plu