I am trying to compile JET templates headless using ANT, but I always met kinds of issues.
I know JET provides a Ant task <jet.compile> task , but as for how to use this task, there is tricks and difficulites.From http:// wiki.eclipse.org/JET_FAQ_How_to_I_compile_JET_templates_in_a _headless_build and http://www.eclipse.org/forums/index.php?t=msg&goto=490154 I know that the Jet project (say, A) should be placed under a workspace, then use Eclipse Ant runner to build it, but I always meet issues.
my build files:
<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================================
compile JET template files into java classes file format.
====================================================================== -->
<project name="compileJET" default="init" basedir=".">
<property file="compileBuild.properties" />
<property name="temp-workspace" value="${basedir}/tmpWorkspace"/>
<target name="init">
<mkdir dir="${temp-workspace}" />
<copy todir="${temp-workspace}">
<fileset dir="../">
<include name="com.ibm.cte.jet.jpa/**" />
<include name="com.ibm.cte.jet.transform.postprocess/**"/>
</fileset>
<fileset dir=".">
<include name="pde_build_compile.xml"/>
</fileset>
</copy>
</target>
<!--
This target actually executes the PDE Build process by launching the
Eclipse antRunner application.
-->
<target name="pde-build" depends="init">
<echo message="Executing ${eclipseLocation}/plugins/org.eclipse.equinox.launcher_${equinoxLauncherPluginVersion}.jar" />
<property name="builder" value="${temp-workspace}"/>
<java classname="org.eclipse.equinox.launcher.Main" fork="true" failonerror="true">
<arg value="-application" />
<arg value="org.eclipse.ant.core.antRunner" />
<arg value="-buildfile" />
<arg value="${temp-workspace}/pde_build_compile.xml" />
<arg value="-Dtimestamp=${timestamp}" />
<classpath>
<pathelement location="${eclipseLocation}/plugins/org.eclipse.equinox.launcher_${equinoxLauncherPluginVersion}.jar" />
</classpath>
</java>
</target>
</project>
the the pde_build_compile project:
<project name="Build All Elements" default="main">
<property name="builder" location="${user.dir}"/>
<property name="builderDirectory" location="${builder}"/>
<available property="customTargets" file="${builder}/customTargets.xml" value="${builder}/customTargets.xml"/>
<!-- ===================================================================== -->
<!-- main entry point to setup, fetch, generate, build etc. Use -->
<!-- the customTargets.xml to modify the build behaviour. -->
<!-- ===================================================================== -->
<!-- ******* add in the descriptions for each of the top level targets to teh target decl -->
<target name="main" description="the main build target">
<antcall target="preBuild" />
</target>
<!-- ===================================================================== -->
<!-- Steps to do before starting the build. Typical setup includes -->
<!-- fetching the map files and building the directory. -->
<!-- ===================================================================== -->
<target name="preBuild">
<echo >compile project com.ibm.cte.jet.jpa </echo>
<jet.compile project="com.ibm.cte.jet.jpa" destdir="jet2java" >
<srcdir dir="." includes="templates/**/*.jet"/>
</jet.compile>
<jet.compile project="com.ibm.cte.jet.transform.postprocess" destdir="jet2java" >
<srcdir dir="." includes="templates/**/*.jet"/>
</jet.compile>
</target>
</project>
When I run the compileJET build, it create folders tree:
build
+++tmpWorkspace
+++++++++pde_build_compile.xml
+++++++++com.jet.project.tobe.compiled
+++++++++.....
The returned result is:
Buildfile: D:\autobuild\com.ibm.cte.jet.build\compile.xml
init:
[copy] Copying 1 file to D:\autobuild\com.ibm.cte.jet.build\tmpWorkspace
pde-build:
[echo] Executing C:/IBM/SDP/plugins/org.eclipse.equinox.launcher_1.0.101.R3
4x_v20081125.jar
[java] 00:00.40 WARNING [Thread:main] org.eclipse.emf.ecore.plugin.Extensio
nParserRegistryReader readElement
[java] Both 'com.ibm.ccl.soa.deploy.http' and 'com.ibm.ws.sca.scdl.http'
register an extension parser for 'http'
[java] Buildfile: D:\autobuild\com.ibm.cte.jet.build/tmpWorkspace/pde_build
_compile.xml
[java]
[java] main:
[java]
[java] preBuild:
[java] [echo] compile project com.ibm.cte.jet.jpa
[java]
[java] BUILD FAILED
[java] D:\autobuild\com.ibm.cte.jet.build\tmpWorkspace\pde_build_compile.xm
l:16: The following error occurred while executing this line:
[java] D:\autobuild\com.ibm.cte.jet.build\tmpWorkspace\pde_build_compile.xm
l:26: project does not exist
[java]
[java] Total time: 0 seconds
BUILD FAILED
D:\autobuild\com.ibm.cte.jet.build\compile.xml:29: Java returned: 13
Would anyone have use feature before and give me some advice?