diff --git a/README.md b/README.md index cdddae0..e064662 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ Following are the tools which this project internally uses: - [Swagger Parser] - [Plant UML] - [Graphviz] +- [Mustache] Please [install](https://graphviz.gitlab.io/download/) Graphviz on your machines, ensure you edit PATH varible of your machine and add bin folder of graphviz. @@ -62,3 +63,4 @@ Apacahe 2.0 [Swagger]: [Swagger Parser]: [Graphviz]: +[Mustache]: \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6e06ab8..73ec6da 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 io.github.kicksolutions @@ -72,6 +73,7 @@ 1.0.33 0.8.18 3.8.1 + 7999 @@ -92,23 +94,27 @@ compiler ${version.mustache} + + net.sourceforge.plantuml + plantuml + ${version.net.sourceforge.plantuml} + swagger2puml-core - + src/main/java org.apache.maven.plugins maven-compiler-plugin - 3.1 - 1.7 - 1.7 + ${maven.compiler.source} + ${maven.compiler.target} @@ -125,7 +131,7 @@ - + diff --git a/swagger2puml-core/pom.xml b/swagger2puml-core/pom.xml index 9231cda..642da5c 100644 --- a/swagger2puml-core/pom.xml +++ b/swagger2puml-core/pom.xml @@ -1,4 +1,5 @@ - + 4.0.0 @@ -11,10 +12,10 @@ swagger-plantuml-core 0.0.1-SNAPSHOT Core POM to generate Plant UML from Swagger - + jar swagger2plantuml-core - + junit @@ -29,5 +30,9 @@ com.github.spullara.mustache.java compiler + + net.sourceforge.plantuml + plantuml + \ No newline at end of file diff --git a/swagger2puml-core/src/main/java/com/kicksolutions/swagger/plantuml/Swagger2PlantUML.java b/swagger2puml-core/src/main/java/com/kicksolutions/swagger/plantuml/Swagger2PlantUML.java index 424c43e..8cb3d80 100644 --- a/swagger2puml-core/src/main/java/com/kicksolutions/swagger/plantuml/Swagger2PlantUML.java +++ b/swagger2puml-core/src/main/java/com/kicksolutions/swagger/plantuml/Swagger2PlantUML.java @@ -1,6 +1,7 @@ package com.kicksolutions.swagger.plantuml; import java.io.File; +import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; @@ -81,16 +82,28 @@ private void transformSwagger2Puml(String specFile,String output,boolean generat LOGGER.info("Processing File --> "+ specFile); pumlPath = codegen.generatePuml(); LOGGER.info("Sucessfully Create PUML !!!"); + + generateUMLDiagram(pumlPath, targetLocation); } catch(Exception e){ LOGGER.log(Level.SEVERE, e.getMessage(),e); - System.exit(1); + throw new RuntimeException(e); } - } - else{ + }else{ LOGGER.severe(USAGE); } LOGGER.exiting(LOGGER.getName(), "transformSwagger2Puml"); } + + /** + * + * @param pumlLocation + * @param targetLocation + * @throws IOException + * @throws InterruptedException + */ + private void generateUMLDiagram(String pumlLocation,File targetLocation) throws IOException, InterruptedException{ + net.sourceforge.plantuml.Run.main(new String[]{"-tsvg","-o",targetLocation.getAbsolutePath(),"-I",pumlLocation}); + } } \ No newline at end of file