Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Why does JET not re-create files on jet2java
Why does JET not re-create files on jet2java [message #63886] Wed, 08 July 2009 10:05 Go to next message
aart matsinger is currently offline aart matsingerFriend
Messages: 12
Registered: July 2009
Junior Member
Hi,

In order to try to understand and control the JET mechanism I deleted the
content of the 'jet2java' folder, expecting that the files would be
generated when executing the related JET transformation. Instead I got an
error:
'Could not load JET template'. The suggestions found in FAQ seemed not
applicable. Quickfix on the error msg suggested that I had to provide a
class 'JET2TemplateLoader', which should however come from the folder of
the generated java files.
I created a new JET project and copied the model and template files from
the original JET project into the new JET project, and that this solved
the problem.
Could anybody explain why JET behaves this way ?

kind regards,
Aart
Re: Why does JET not re-create files on jet2java [message #63910 is a reply to message #63886] Wed, 08 July 2009 13:38 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Aart:

The contents of the jet2java are created by the JET 'builder'. The builder
is an incremental compiler that translates each .jet file into a .java
file when it detects that the .jet file has changed.

If you delete the contents of jet2java, the builder does nothing - it is
only triggered by changes to the .jet files. This behavior is similar to
the Eclipse Java builder - if you go into a Java project's bin directory
and delete .class files, they do not get recreated automatically.

So, what to do? Force a full rebuild:

1) Click Project > Clean...
2) Choose either 'Clean all projects' or 'Clean projects selected below'.
If you choose the second, check the your JET project.


The error you are seeing on running the JET project is an indication that
the Java classes corresponding to your JET templates could not be found
(because you deleted them).

So, to summarize, jet2java is created by the JET builder (aka compiler).
Like a Java project's bin directory, it is necessary for the execution of
the JET project. It is not the result of the execution of the JET project.

If you are looking for the results of executing your JET project, you need
to take a look at templates/main.jet. This JET template controls the
execution of other JET templates, and is responsible for determining where
template output is written.

Control of template output is typically done via the <ws:file> tag:

<ws:file
path="workspace-relative-path-for-the-output"

template=" project-relative-path-to-the-jet-template-that-creates-the-c ontent "/>

A very simple main.jet template would be the following:

<ws:file path="{$org.eclipse.jet.resource.project.name}/hello.txt"
template="templates/hello.jet"/>

This tag executes the template 'templates/hello.jet' and writes the
resulting output to a file hello.txt in the root of the project containing
the input to the JET project. (The text
{$org.eclipse.jet.resource.project.name} is a reference to the project
name containing the input.)

In most real-world JET transformations, the location of the output is
determined in one of two ways:
1) derived from the location of the input to the JET transformation
2) derived from content contained in the input to the JET transformation

Does this help?

Paul
Re: Why does JET not re-create files on jet2java [message #63933 is a reply to message #63910] Wed, 08 July 2009 13:54 Go to previous message
aart matsinger is currently offline aart matsingerFriend
Messages: 12
Registered: July 2009
Junior Member
Hi Paul,

Thanks for your clear explanation. It helps to understand better how JET
worjs.
I followed your instructions and this result was as described.

kind regards,
Aart
Previous Topic:com.sun.java.xml.ns.persistence.orm.OrmPackage
Next Topic:How to run workflow from own code
Goto Forum:
  


Current Time: Sat Dec 21 13:47:20 GMT 2024

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

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

Back to the top