Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » jetc fails for multiple templates
jetc fails for multiple templates [message #488913] Wed, 30 September 2009 17:06 Go to next message
No real name is currently offline No real name
Messages: 14
Registered: September 2009
Junior Member
I am using jetc to generate code from jet templates. It works for single templates but when I use it for multiple templates, it fails.

I am following the syntax as I found in http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index. jsp?topic=/org.eclipse.emf.doc/tutorials/jet2/jet_tutorial2. html

This is what I have in my build.xml:
<target name="jetc_multiple_templates">
<jetc destdir="src">
<fileset dir="templates/code"/>
</jetc>
</target>

It finds the templates under templates/code but gives an error as follows:
org.eclipse.emf.codegen.jet.JETException: C:\..\project_root_dir\template1.javajet (The system cannot find the file specified)

The correct path of the template file should be C:\..\project_root_dir\templates\code\template1.javajet but the error shows it as C:\..\project_root_dir\template1.javajet .

Is the syntax that I am using for jetc correct or do I need to change anything?

Any help will be appreciated!
Re: jetc fails for multiple templates [message #489730 is a reply to message #488913] Mon, 05 October 2009 17:13 Go to previous messageGo to next message
Paul Elder is currently offline Paul Elder
Messages: 849
Registered: July 2009
Senior Member
Hi:

I don't have an exact answer, but a couple of observations.

1) In the article you quote, the <fileset> tag is used as follows:

<fileset dir="jet-templates" includes="*.*jet"/>

This differs from how you have used it. Would changing your ANT script to use

<fileset dir="templates/code" includes="*.*jet"/>

make a difference?

2) If the above doesn't work, I'd guess you will have to debug the code for the jetc task (which is included with the article). Here is my starting point when trying to figure out all things ANT:

http://ant.apache.org/manual/index.html

3) Both EMF, which distributes the version of JET you are using (aka JET1) and M2T-JET (aka JET2) include ANT tasks for compiling their templates.

For JET1 (EMF Codegen), look at

http://help.eclipse.org/galileo/topic/org.eclipse.emf.doc/re ferences/javadoc/org/eclipse/emf/ant/taskdefs/codegen/JETCom pilerTask.html

For JET2 (M2T-JET), look at

http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .jet.doc/references/ant/antTasks.xhtml

Paul
Re: jetc fails for multiple templates [message #489738 is a reply to message #489730] Mon, 05 October 2009 17:32 Go to previous message
No real name is currently offline No real name
Messages: 14
Registered: September 2009
Junior Member
Hi Paul!

thanks for the response. I was able to get jetc to work for multiple templates. I had to modify my build.xml as follows:

<target name="jetc_multiple_templates">
<jetc destdir="src">
<fileset dir="${basedir}" includes="templates/code/*.*jet"/>
</jetc>
</target>

I am now trying to build a JET2 project using jet.compile. My build.xml looks as follows:

<target name="jet-init">
<path id="Plug-in Dependencies.libraryclasspath">
<pathelement location=" ${eclipse.plugins.dir}/org.eclipse.text_3.5.0.v20090513-2000 .jar "/>
<pathelement location=" ${eclipse.plugins.dir}/org.eclipse.jet_1.0.0.v200906120900.j ar "/>
<pathelement location=" ${eclipse.plugins.dir}/org.eclipse.jet.core_1.1.100.v2009061 20900.jar "/>
<pathelement location=" ${eclipse.plugins.dir}/org.eclipse.emf.common_2.5.0.v2009061 51043.jar "/>
<pathelement location=" ${eclipse.plugins.dir}/org.eclipse.jet.source-0.8.0-v2007053 0.jar "/>
<pathelement location="${java.class.path}"/>
</path>
<path id="project.classpath">
<pathelement location="build/" />
<path refid="Plug-in Dependencies.libraryclasspath" />
<fileset dir="${eclipse.plugins.dir}" includes="**/*.*"/>
</path>

<taskdef name="jet.compile" classname="org.eclipse.jet.ant.tasks.JETCompileTask">
<classpath refid="Plug-in Dependencies.libraryclasspath" />
<classpath refid="project.classpath" />
</taskdef>
</target>

<target name="jetc_multiple_templates" depends="jet-init">
<jet.compile project="com.accenture.tools.tabbed" destdir="src">
<srcdir dir="templates" includes="*.*"/>
</jet.compile>
</target>


I am trying to build thid build.xml just like I did with the jetc one (using maven). But this one does not work for some reason. It gives me 'Workspace is closed' error.

How do I do it from the command line?
I tried the following. It starts eclipse but does not do any build:
C:\opt\eclipse\eclipse.exe -application org.eclipse.ant.core.antRunn
er -data C:\Users\gincy.z.varghese\workspace1 ant -f C:\Users\gincy.z.varghese\workspace1\com.accenture.tools.tab bed\build.xml jetc_
multiple_templates

Any help / suggestions will be appreciated.

Thanks!
Previous Topic:Problems running sample XPand code
Next Topic:[JET] UML2 dependancy from JET 1.0
Goto Forum:
  


Current Time: Fri Oct 31 06:38:39 GMT 2014

Powered by FUDForum. Page generated in 0.01634 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software