You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jv...@apache.org on 2003/05/27 15:39:56 UTC
cvs commit: maven/src/plugins-build/castor/xdocs examples.xml tags.xml goals.xml index.xml navigation.xml properties.xml
jvanzyl 2003/05/27 06:39:56
Modified: src/plugins-build/castor plugin.jelly plugin.properties
project.xml
src/plugins-build/castor/xdocs goals.xml index.xml
navigation.xml properties.xml
Added: src/plugins-build/castor/xdocs examples.xml tags.xml
Log:
o Applying Tim Anderson's patches for the castor plugin.
Revision Changes Path
1.3 +68 -9 maven/src/plugins-build/castor/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/castor/plugin.jelly,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- plugin.jelly 26 Mar 2003 23:27:44 -0000 1.2
+++ plugin.jelly 27 May 2003 13:39:55 -0000 1.3
@@ -1,16 +1,74 @@
-<project
- xmlns:j="jelly:core"
- xmlns:ant="jelly:ant"
- xmlns:define="jelly:define"
- xmlns:castor="castor">
+<?xml version="1.0"?>
+
+<project xmlns:j="jelly:core"
+ xmlns:ant="jelly:ant"
+ xmlns:define="jelly:define"
+ xmlns:castor="castor"
+ xmlns:maven="jelly:maven">
<!-- ================================================================== -->
<!-- C A S T O R -->
<!-- ================================================================== -->
- <define:taglib uri="castor">
- <define:tag name="srcgen">
- <ant:java
+ <goal name="castor:prepare-filesystem"
+ description="Make any necessary directories for castor processing">
+ <ant:mkdir dir="${maven.castor.dest}"/>
+ <ant:mkdir dir="${maven.castor.tstamp}"/>
+
+ <ant:path id="maven.castor.compile.src.set"
+ location="${maven.castor.dest}"/>
+ <maven:addPath id="maven.compile.src.set"
+ refid="maven.castor.compile.src.set"/>
+ </goal>
+
+ <define:taglib uri="castor">
+ <define:tag name="generate">
+ <j:set var="fileVar" value="${schema}.filename"/>
+ <j:set var="uptodateVar" value="${schema}.uptodate"/>
+ <ant:basename property="${fileVar}" file="${schema}"/>
+ <j:set var="filename" value="${pom.getContext().getVariable(fileVar)}"/>
+ <j:set var="context"
+ value="${pom.getPluginContext('maven-castor-plugin')}"/>
+ <j:set var="log" value="${context.getVariable('maven.castor.tstamp')}"/>
+ <j:set var="gen" value="${context.getVariable('maven.castor.dest')}"/>
+
+ <ant:uptodate property="${uptodateVar}" targetfile="${log}/${filename}">
+ <ant:srcfiles dir="${basedir}" includes="${schema}"/>
+ </ant:uptodate>
+
+ <j:set var="uptodate"
+ value="${pom.getContext().getVariable(uptodateVar)}"/>
+
+ <j:if test="${uptodate == null}">
+ <ant:echo message="Generating sources for ${schema}"/>
+
+ <ant:java className="org.exolab.castor.builder.SourceGenerator"
+ failonerror="true">
+ <ant:arg value="-i"/>
+ <ant:arg value="${schema}"/>
+ <ant:arg value="-f"/>
+ <j:if test="${!empty(package)}">
+ <ant:arg value="-package"/>
+ <ant:arg value="${package}"/>
+ </j:if>
+ <j:if test="${!empty(types)}">
+ <ant:arg value="-types"/>
+ <ant:arg value="${types}"/>
+ </j:if>
+ <j:if test="${!empty(marshal) and !marshal.trim().equals('true')}">
+ <ant:arg value="-nomarshall"/>
+ </j:if>
+ <ant:arg value="-dest"/>
+ <ant:arg value="${gen}"/>
+ </ant:java>
+ <ant:touch file="${log}/${filename}"/>
+ </j:if>
+
+ </define:tag>
+
+ <!-- needs to be deprecated -->
+ <define:tag name="srcgen">
+ <ant:java
className="org.exolab.castor.builder.SourceGenerator"
failonerror="true">
@@ -22,6 +80,7 @@
<ant:arg value="-dest${generationDirectory}"/>
</ant:java>
</define:tag>
- </define:taglib>
+
+ </define:taglib>
</project>
1.3 +3 -1 maven/src/plugins-build/castor/plugin.properties
Index: plugin.properties
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/castor/plugin.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- plugin.properties 28 Jan 2003 03:28:33 -0000 1.2
+++ plugin.properties 27 May 2003 13:39:55 -0000 1.3
@@ -1,7 +1,9 @@
# -------------------------------------------------------------------
-# Default Maven properties for the VDoclet plugin.
+# Default Maven properties for the Castor plugin.
# -------------------------------------------------------------------
# These are the properties that we believe are immutable so we
# keep them apart from the project specific properties.
# -------------------------------------------------------------------
+maven.castor.dest=${maven.build.dir}/castor/src
+maven.castor.tstamp=${maven.build.dir}/castor/tstamp
1.9 +1 -1 maven/src/plugins-build/castor/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/castor/project.xml,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- project.xml 9 Apr 2003 01:06:44 -0000 1.8
+++ project.xml 27 May 2003 13:39:55 -0000 1.9
@@ -29,7 +29,7 @@
<dependencies>
<dependency>
<id>castor</id>
- <version>0.9.4</version>
+ <version>0.9.4.3</version>
<properties>
<classloader>root</classloader>
</properties>
1.2 +15 -10 maven/src/plugins-build/castor/xdocs/goals.xml
Index: goals.xml
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/castor/xdocs/goals.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- goals.xml 24 Jan 2003 03:44:50 -0000 1.1
+++ goals.xml 27 May 2003 13:39:55 -0000 1.2
@@ -4,17 +4,22 @@
<properties>
<title>Maven Castor Plug-in Goals</title>
<author email="jason@zenplex.com">Jason van Zyl</author>
+ <author email="tma@netspace.net.au">Tim Anderson</author>
</properties>
<body>
- <goals>
- <goal>
- <name>castor:srcgen</name>
- <description>
- For a given project generate a plexus runtime using the required
- components.
- </description>
- </goal>
- </goals>
- </body>
+ <section name="Goals">
+ <table>
+ <tr><th>Goal</th><th>Description</th></tr>
+ <tr>
+ <td>castor:prepare-filesystem</td>
+ <td>
+ Creates the directories specified by the
+ <a href="properties.html">${maven.castor.dest}</a> and
+ <a href="properties.html">${maven.castor.tstamp}</a> properties.
+ </td>
+ </tr>
+ </table>
+ </section>
+ </body>
</document>
1.2 +35 -4 maven/src/plugins-build/castor/xdocs/index.xml
Index: index.xml
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/castor/xdocs/index.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- index.xml 24 Jan 2003 03:44:50 -0000 1.1
+++ index.xml 27 May 2003 13:39:55 -0000 1.2
@@ -4,13 +4,44 @@
<properties>
<title>Maven Castor Plug-in</title>
<author email="jason@zenplex.com">Jason van Zyl</author>
+ <author email="tma@netspace.net.au">Tim Anderson</author>
</properties>
<body>
<section name="Maven Castor Plug-in">
- <p>
- A plugin that currently just sets up castor for use in Jelly
- </p>
+ <subsection name="Overview of the Castor Plug-in Reference Documentation"> <p>
+ This plugin generates java sources from schemas using Castor.
+ </p>
+ <table>
+ <tr><th>Document</th><th>Description</th></tr>
+ <tr><td><a href="goals.html">Goals</a></td>
+ <td>
+ This document provides detailed information on the various
+ goals that are available as part of the Maven Castor Plug-in.
+ </td>
+ </tr>
+ <tr><td><a href="properties.html">Properties</a></td>
+ <td>
+ The behavior of the Maven Castor Plug-in can be altered via
+ several properties. This document describes each property
+ available, and the default used.
+ </td>
+ </tr>
+ <tr><td><a href="tags.html">Tags</a></td>
+ <td>
+ The Castor plugin defines Jelly tags to generate java
+ sources. This document describes the tags and their
+ arguments.
+ </td>
+ </tr>
+ <tr><td><a href="examples.html">Examples</a></td>
+ <td>
+ This document provides examples on how to use the Maven Castor
+ plugin.
+ </td>
+ </tr>
+ </table>
+ </subsection>
</section>
- </body>
+ </body>
</document>
1.3 +2 -0 maven/src/plugins-build/castor/xdocs/navigation.xml
Index: navigation.xml
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/castor/xdocs/navigation.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- navigation.xml 19 Mar 2003 05:54:16 -0000 1.2
+++ navigation.xml 27 May 2003 13:39:55 -0000 1.3
@@ -11,6 +11,8 @@
<menu name="Overview">
<item name="Goals" href="/goals.html" />
<item name="Properties" href="/properties.html" />
+ <item name="Tags" href="/tags.html" />
+ <item name="Examples" href="/examples.html" />
</menu>
</body>
</project>
1.2 +35 -3 maven/src/plugins-build/castor/xdocs/properties.xml
Index: properties.xml
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/castor/xdocs/properties.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- properties.xml 24 Jan 2003 03:44:50 -0000 1.1
+++ properties.xml 27 May 2003 13:39:55 -0000 1.2
@@ -4,6 +4,7 @@
<properties>
<title>Maven Castor Plugin Properties</title>
<author email="jason@zenplex.com">Jason van Zyl</author>
+ <author email="tma@netspace.net.au">Tim Anderson</author>
</properties>
<body>
@@ -11,13 +12,44 @@
<table>
<tr>
<th>Property name</th>
+ <th>Description</th>
<th>Optional?</th>
+ </tr>
+ <tr>
+ <td>maven.castor.dest</td>
+ <td>
+ Specifies the directory to place generated sources.<br/>
+ Defaults value is ${maven.build.dir}/castor/src
+ </td>
+ <td>Yes</td>
+ </tr>
+ <tr>
+ <td>maven.castor.tstamp</td>
+ <td>
+ Specifies the directory to output timestamp files.
+ These are used to track source modifications against the
+ generated files, to avoid unecessary generation.<br/>
+ Default value is ${maven.build.dir}/castor/tstamp
+ </td>
+ <td>Yes</td>
+ </tr>
+ </table>
+ </section>
+ <section name="Other properties used">
+ <table>
+ <tr>
+ <th>Property name</th>
<th>Description</th>
+ <th>Optional?</th>
</tr>
<tr>
- <td></td>
- <td></td>
- <td></td>
+ <td>maven.compile.src.set</td>
+ <td>
+ The source directories maven uses to compile java code.
+ The Castor plugin adds the directory it generates code to
+ this path, so that generated code is compiled seamlessly
+ </td>
+ <td>Yes</td>
</tr>
</table>
</section>
1.1 maven/src/plugins-build/castor/xdocs/examples.xml
Index: examples.xml
===================================================================
<?xml version="1.0"?>
<document>
<properties>
<title>Maven Castor Plug-in Examples</title>
<author email="tma@netspace.net.au">Tim Anderson</author>
</properties>
<body>
<section name="Examples">
<p>
The following generates java sources for the foo.xsd' schema,
in the 'com.foo.bar' package. The sources will use Java 2 collection
types.
<source><![CDATA[
<preGoal name="java:compile">
<attainGoal name="castor:prepare-filesystem"/>
<castor:generate schema="src/schemas/foo.xsd"
package="com.foo.bar"
types="j2"/>
</preGoal>
]]></source>
</p>
<p>
The following generates java sources for the 'bar.xsd' schema.
The sources will not included marshalling support (marshal,
unmarshal, validate).
<source><![CDATA[
<preGoal name="java:compile">
<attainGoal name="castor:prepare-filesystem"/>
<castor:generate schema="src/schemas/types.xsd"
marshal="false"/>
</preGoal>
]]></source>
</p>
</section>
</body>
</document>
1.1 maven/src/plugins-build/castor/xdocs/tags.xml
Index: tags.xml
===================================================================
<?xml version="1.0"?>
<document>
<properties>
<title>Maven Castor Plug-in Tags</title>
<author email="tma@netspace.net.au">Tim Anderson</author>
</properties>
<body>
<section name="Overview">
<p>
This document describes the
<a href="http://jakarta.apache.org/commons/jelly/tags.html">tags</a>
that are available when using the Castor Plug-in with Maven.
</p>
<p>
Please refer to the
<a href="../../start/integrate.html">Integration</a> document for
more information on how to integrate these tags into
your project.
</p>
</section>
<section name="Tags">
<table>
<tr><th>Goal</th><th>Description</th></tr>
<tr>
<td><a href="#castor:generate">castor:generate</a></td>
<td>Generate java sources from an XML Schema.</td>
</tr>
<tr>
<td>castor:srcgen</td>
<td><strong>DEPRECATED</strong>. Use castor:generate instead</td>
</tr>
</table>
<subsection name="castor:generate">
<p>
The <code>castor:generate</code> target generates java sources
from an XML Schema (<code>XSD</code> file). <br/>
Sources are generated in the
<a href="properties.html">${maven.castor.dest}</a> directory.<br/>
Sources are only generated if the input schema is newer than any
existing generated source.
</p>
<table>
<tr>
<th>Attribute Name</th><th>Description</th><th>Optional?</th>
</tr>
<tr>
<td>schema</td>
<td>The path to the XML schema</td>
<td>No</td>
</tr>
<tr>
<td>package</td>
<td>The package for the generated source</td>
<td>Yes</td>
</tr>
<tr>
<td>types</td>
<td>Sets which type factory to use. This is useful if you want
JDK 1.2 collections instead of JDK 1.1, or if you want to pass
in your own FieldInfoFactory.<br/>
If not specified, java.util.Vector will be used for
collections.<br/>
See
<a href="http://castor.exolab.org/sourcegen.html#Collection-Types">Collection Types</a>
for valid values.
</td>
<td>Yes</td>
</tr>
<tr>
<td>marshal</td>
<td>
If 'false', disables generation of the marshalling framework
methods (marshal, unmarshal, validate).<br/>
Defaults to 'true'.
</td>
<td>Yes</td>
</tr>
</table>
</subsection>
</section>
</body>
</document>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org