| 1 |
<!-- =================================================================== |
|---|
| 2 |
Run xjc, the JAXB compiler on a schema. |
|---|
| 3 |
|
|---|
| 4 |
The jaxb released with java6 is version 2.1. However, to resolve some |
|---|
| 5 |
issues we have to use version 2.2. This requires either placing the |
|---|
| 6 |
jaxb jars in the endorsed directory or setting xendorsed="true" when |
|---|
| 7 |
running wsimport and adding the 2.2 jars to the classpath. |
|---|
| 8 |
|
|---|
| 9 |
The version of jboss in the quickstart has the 2.2 jars in its |
|---|
| 10 |
endorsed directory. For the moment we point at that. |
|---|
| 11 |
|
|---|
| 12 |
Hold that: Unfortunately eclipse doesn't appear to have a way to set |
|---|
| 13 |
an endorsed directory for a single project. The generated 2.2 classes |
|---|
| 14 |
don't compile. Managed to get 2.1 wsimport to run - the generated code |
|---|
| 15 |
appears to run OK on 2.2 |
|---|
| 16 |
|
|---|
| 17 |
@param schema Location of the schema |
|---|
| 18 |
@param sourcedestdir Location for the generated source |
|---|
| 19 |
|
|---|
| 20 |
Authors: Mike Douglass douglm rpi.edu |
|---|
| 21 |
=================================================================== --> |
|---|
| 22 |
|
|---|
| 23 |
<project name="do.xjc" basedir="." default=""> |
|---|
| 24 |
<macrodef name="xjc"> |
|---|
| 25 |
<attribute name="schema"/> |
|---|
| 26 |
<attribute name="module-base"/> |
|---|
| 27 |
<attribute name="jar-file"/> |
|---|
| 28 |
<attribute name="bindingsdir" default="" /> |
|---|
| 29 |
<attribute name="dependencies" default="empty.fileset" /> |
|---|
| 30 |
<sequential> |
|---|
| 31 |
<taskdef resource="net/sf/antcontrib/antcontrib.properties" /> |
|---|
| 32 |
|
|---|
| 33 |
<var name="sourcedestdir" value="@{module-base}/src" /> |
|---|
| 34 |
|
|---|
| 35 |
<dirname property="org.bedework.schema.dir" file="@{schema}"/> |
|---|
| 36 |
|
|---|
| 37 |
<var name="org.bedework.source.changed" value="false" /> |
|---|
| 38 |
|
|---|
| 39 |
<outofdate outputsources="org.bedework,changed.sources"> |
|---|
| 40 |
<sourcefiles> |
|---|
| 41 |
<fileset dir="${org.bedework.schema.dir}"/> |
|---|
| 42 |
<fileset refid="@{dependencies}"/> |
|---|
| 43 |
</sourcefiles> |
|---|
| 44 |
<targetfiles> |
|---|
| 45 |
<pathelement path="@{jar-file}"/> |
|---|
| 46 |
</targetfiles> |
|---|
| 47 |
<sequential> |
|---|
| 48 |
<var name="org.bedework.source.changed" value="true" /> |
|---|
| 49 |
</sequential> |
|---|
| 50 |
</outofdate> |
|---|
| 51 |
|
|---|
| 52 |
<noisyMsg message="**** org.bedework,changed.sources = ${org.bedework,changed.sources}" /> |
|---|
| 53 |
<noisyMsg message="**** org.bedework.source.changed = ${org.bedework.source.changed}" /> |
|---|
| 54 |
|
|---|
| 55 |
<if> |
|---|
| 56 |
<not> |
|---|
| 57 |
<equals arg1="${org.bedework.source.changed}" arg2="true" /> |
|---|
| 58 |
</not> |
|---|
| 59 |
<then> |
|---|
| 60 |
<noisyMsg message="**** @{jar-file} is up to date" /> |
|---|
| 61 |
</then> |
|---|
| 62 |
<else> |
|---|
| 63 |
<noisyMsg message="**** @{jar-file} needs rebuilding" /> |
|---|
| 64 |
|
|---|
| 65 |
<delete dir="${sourcedestdir}" /> |
|---|
| 66 |
<mkdir dir="${sourcedestdir}" /> |
|---|
| 67 |
|
|---|
| 68 |
<!-- |
|---|
| 69 |
<getJar name="jaxws-tools" version="2.2" /> |
|---|
| 70 |
<getJar name="jaxb-xjc" version="2.2" /> |
|---|
| 71 |
<getJar name="jaxws-rt" version="2.2" /> |
|---|
| 72 |
--> |
|---|
| 73 |
<property name="xjc.lib" |
|---|
| 74 |
location="${org.bedework.temp.dir}/xjclib" /> |
|---|
| 75 |
<mkdir dir="${org.bedework.temp.dir}" /> |
|---|
| 76 |
<delete dir="${xjc.lib}" /> |
|---|
| 77 |
<mkdir dir="${xjc.lib}" /> |
|---|
| 78 |
|
|---|
| 79 |
<getJar lib="${xjc.lib}" |
|---|
| 80 |
libcache="${org.bedework.libcache.dir}" |
|---|
| 81 |
name="jaxws-tools" version="2.1.4" /> |
|---|
| 82 |
<getJar lib="${xjc.lib}" |
|---|
| 83 |
libcache="${org.bedework.libcache.dir}" |
|---|
| 84 |
name="jaxb-xjc" version="2.1.7" /> |
|---|
| 85 |
<getJar lib="${xjc.lib}" |
|---|
| 86 |
libcache="${org.bedework.libcache.dir}" |
|---|
| 87 |
name="jaxb-impl" version="2.1.8" /> |
|---|
| 88 |
<getJar lib="${xjc.lib}" |
|---|
| 89 |
libcache="${org.bedework.libcache.dir}" |
|---|
| 90 |
name="jaxws-rt" version="2.1.4" /> |
|---|
| 91 |
<getJar lib="${xjc.lib}" |
|---|
| 92 |
libcache="${org.bedework.libcache.dir}" |
|---|
| 93 |
name="streambuffer" version="1.0" /> |
|---|
| 94 |
<getJar lib="${xjc.lib}" |
|---|
| 95 |
libcache="${org.bedework.libcache.dir}" |
|---|
| 96 |
name="stax-ex" version="2.2.1" /> |
|---|
| 97 |
|
|---|
| 98 |
<path id="xjc.classpath"> |
|---|
| 99 |
<fileset dir="${ant.home}/lib"> |
|---|
| 100 |
<include name="jax*.jar"/> |
|---|
| 101 |
</fileset> |
|---|
| 102 |
<!-- |
|---|
| 103 |
<pathelement location="${xjc.lib}/jaxws-tools-2.2.jar"/> |
|---|
| 104 |
<pathelement location="${xjc.lib}/jaxb-xjc-2.2.jar"/> |
|---|
| 105 |
<pathelement location="${xjc.lib}/jaxws-rt-2.2.jar"/> |
|---|
| 106 |
--> |
|---|
| 107 |
<pathelement location="${xjc.lib}/jaxws-tools-2.1.4.jar"/> |
|---|
| 108 |
<pathelement location="${xjc.lib}/jaxb-xjc-2.1.7.jar"/> |
|---|
| 109 |
<pathelement location="${xjc.lib}/jaxb-impl-2.1.8.jar"/> |
|---|
| 110 |
<pathelement location="${xjc.lib}/jaxws-rt-2.1.4.jar"/> |
|---|
| 111 |
<!-- |
|---|
| 112 |
<pathelement location="${xjc.lib}/tools-1.6.0_21.jar" /> |
|---|
| 113 |
--> |
|---|
| 114 |
<pathelement location="${xjc.lib}/streambuffer-1.0.jar" /> |
|---|
| 115 |
<pathelement location="${xjc.lib}/stax-ex-2.2.1.jar" /> |
|---|
| 116 |
<fileset dir="${ant.home}/lib"> |
|---|
| 117 |
<include name="**/*.jar"/> |
|---|
| 118 |
</fileset> |
|---|
| 119 |
<!-- |
|---|
| 120 |
<fileset dir="${org.bedework.appserver.dir}/lib/endorsed" > |
|---|
| 121 |
<include name="**/*.jar"/> |
|---|
| 122 |
</fileset> |
|---|
| 123 |
--> |
|---|
| 124 |
</path> |
|---|
| 125 |
|
|---|
| 126 |
<debugCpid idpar="xjc.classpath" /> |
|---|
| 127 |
|
|---|
| 128 |
<taskdef name="xjctask" classname="com.sun.tools.xjc.XJCTask"> |
|---|
| 129 |
<classpath refid="xjc.classpath" /> |
|---|
| 130 |
</taskdef> |
|---|
| 131 |
|
|---|
| 132 |
<!-- We don't want the generated classes but there doesn't appear to be a |
|---|
| 133 |
way to suppress generation --> |
|---|
| 134 |
<property name="xjc.dest" |
|---|
| 135 |
location="${org.bedework.temp.dir}/xjcclasses" /> |
|---|
| 136 |
<mkdir dir="${xjc.dest}" /> |
|---|
| 137 |
|
|---|
| 138 |
<if> |
|---|
| 139 |
<equals arg1="@{bindingsdir}" arg2="" /> |
|---|
| 140 |
<then> |
|---|
| 141 |
<xjctask destdir="${sourcedestdir}" |
|---|
| 142 |
schema="@{schema}" > |
|---|
| 143 |
</xjctask> |
|---|
| 144 |
</then> |
|---|
| 145 |
<else> |
|---|
| 146 |
<xjctask destdir="${sourcedestdir}" |
|---|
| 147 |
schema="@{schema}" |
|---|
| 148 |
extension="true"> |
|---|
| 149 |
<binding dir="@{bindingsdir}" includes="*.xml"> |
|---|
| 150 |
</binding> |
|---|
| 151 |
</xjctask> |
|---|
| 152 |
</else> |
|---|
| 153 |
</if> |
|---|
| 154 |
|
|---|
| 155 |
|
|---|
| 156 |
<build-jar module-base="@{module-base}" |
|---|
| 157 |
jar-file="@{jar-file}" /> |
|---|
| 158 |
</else> |
|---|
| 159 |
</if> |
|---|
| 160 |
</sequential> |
|---|
| 161 |
</macrodef> |
|---|
| 162 |
</project> |
|---|