Hi Stephen,
You might also be interested in this:

https://github.com/ephemerian/schemagen-maven

Note that there's a pull request that I need to find time to merge into master.

Ian


On 25/09/12 22:09, [email protected] wrote:
Author: sallen
Date: Tue Sep 25 21:09:18 2012
New Revision: 1390140

URL: http://svn.apache.org/viewvc?rev=1390140&view=rev
Log:
Added documentation on using schemagen with Maven.

Modified:
     jena/site/trunk/content/documentation/tools/schemagen.mdtext

Modified: jena/site/trunk/content/documentation/tools/schemagen.mdtext
URL: 
http://svn.apache.org/viewvc/jena/site/trunk/content/documentation/tools/schemagen.mdtext?rev=1390140&r1=1390139&r2=1390140&view=diff
==============================================================================
--- jena/site/trunk/content/documentation/tools/schemagen.mdtext (original)
+++ jena/site/trunk/content/documentation/tools/schemagen.mdtext Tue Sep 25 
21:09:18 2012
@@ -646,6 +646,57 @@ Note that Java compilers typically impos
  specifically, on the size of `.class` file they will generate. Loading a 
particularly large
  vocabulary with `--includeSource` may risk breaching that limit.

+## Using schemagen with Maven
+
+[Apache Maven](http://maven.apache.org/) is a build automation tool typically 
used for Java.  You can use `exec-maven-plugin` and `build-helper-maven-plugin` 
to run `schemagen` as part of the `generate-sources` goal of your project.  The 
following example shows one way of performing this task.  The developer should 
customize command-line options or use a configuration file instead as needed.
+
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>exec-maven-plugin</artifactId>
+            <executions>
+              <execution>
+                <phase>generate-sources</phase>
+                <goals>
+                  <goal>java</goal>
+                </goals>
+                <configuration>
+                  <mainClass>jena.schemagen</mainClass>
+                  <commandlineArgs>
+                    --inference \
+                    -i ${basedir}/src/main/resources/example.ttl \
+                    -e TTL \
+                    --package org.example.ont \
+                    -o ${project.build.directory}/generated-sources/java \
+                    -n ExampleOnt
+                  </commandlineArgs>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>build-helper-maven-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>add-source</id>
+                <goals>
+                  <goal>add-source</goal>
+                </goals>
+                <configuration>
+                  <sources>
+                    
<source>${project.build.directory}/generated-sources/java</source>
+                  </sources>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        <plugins>
+      <build>
+
+At this point you can run `mvn generate-sources` in your project to cause 
`schemagen` to run and create your Java source (note that this goal is run 
automatically from `mvn compile` or `mvn install`, so there really isn't any 
reason to to run it manually unless you wish to just generate the source).  The 
source file is placed in the maven standard `target/generated-sources/java` 
directory, which is added to the project classpath by 
`build-helper-maven-plugin`.
+

  ## Using schemagen with Ant





--
____________________________________________________________
Ian Dickinson                   Epimorphics Ltd, Bristol, UK
mailto:[email protected]        http://www.epimorphics.com
cell: +44-7786-850536              landline: +44-1275-399069
------------------------------------------------------------
Epimorphics Ltd.  is a limited company registered in England
(no. 7016688). Registered address: Court Lodge, 105 High St,
              Portishead, Bristol BS20 6PT, UK

Reply via email to