Introduction
The Jastor Maven Plugin is a simple prototype, showing how you would be able to generate a Java representation of an OWL ontology using Maven 2.
Jastor already ships an Ant task for embedding it in Ant based projects, but many projects are currently shifting to Maven, and there are some issues with using the Maven Antrun Plugin to call the Jastor Ant Task from Maven.
Benefits
So what are the benefits of using the Jastor Maven Plugin, compared to the Ant Task?
- First of all, with Maven, you don't need to download and install Jastor at all. As long as the repository containing the Jastor plugin is in your pom.xml file, you can simply specify that you want the jastor-maven-plugin to perform its work as part of the generate-sources phase. Maven will automatically download the jar file containing the plugin, as well as a number of other libraries. (As soon as the Jastor Maven Plugin gets uploaded to the central Maven repository, you no longer need to specify the additional repository in your pom.)
- Additionally, the Jastor Maven Plugin will automatically register the generated sources for compilation in the compilation phase. As a consequence, building a jar file containing all of the classes generated by Jastor could be as simple as this:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>...</version>
<build>
<plugins>
<plugin>
<groupId>com.agilejava.jastor</groupId>
<artifactId>jastor-maven-plugin</groupId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<ontologies>
<ontology>
<path>${basedir}/test.owl</path>
<packageName>com.agilejava.owl.test</packageName>
</ontology>
</ontologies>
</configuration>
</plugin>
</plugins>
</build>
</project>