Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Problem using jet.compile ANT task
Problem using jet.compile ANT task [message #68121] Mon, 15 January 2007 20:45 Go to next message
Robert Goodman is currently offline Robert GoodmanFriend
Messages: 5
Registered: July 2009
Junior Member
I'm trying to use the jet.compile ANT task, but I'm having problem getting
the generated code.

The ANT task looks like the following

<jet.compile project="org.eclipse.atf.generator"
destDir="plugins/org.eclipse.atf.generator/src-generated">
<srcdir dir="plugins/org.eclipse.atf.generator/templates"/>
</jet.compile>

I get the following messaging print in the output

postFetch:
[jet.compile] destdir: plugins/org.eclipse.atf.generator/src-generated
[jet.compile] Compiling: appWizard.javajet
[jet.compile] Compiling: builder.javajet
[jet.compile] Compiling: facetInstallDelegate.javajet
[jet.compile] Compiling: facetUninstallDelegate.javajet
[jet.compile] Compiling: nature.javajet
[jet.compile] Compiling: runtimehandler.javajet
[jet.compile] Compiling: templateContextType.javajet

Everything seems to run correctly, but I don't get the generated code.

Thanks
Bob
Re: Problem using jet.compile ANT task [message #68262 is a reply to message #68121] Tue, 16 January 2007 16:50 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Bob:

The jet.compile task compiles "JET2" templates. Looking at your build
output, I'd guess that you are using what I would call "Classic JET" - the
JET that is included with EMF.

I think the task you want to use is emf.JETEmitter. See:

http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. emf.doc/references/javadoc/org/eclipse/emf/ant/taskdefs/code gen/JETEmitterTask.html

If you are really using JET2, then you need to add .javajet as an extension
recognized by the compiler on the particular project. See the EMFT JET page
in the project's Properties dialog if that is the case.

FYI, the salient differences between the two are:

Classic JET
* Based on JSP scriptlets <%= ... %> and expressions <% ... %>
* Each template creates a Java class with a single public method:
String generate(Object argument)
* To consume the template, you must write a Java program that instantiates
the generated Java class and calls this method. You must also write any/all
code necessary to so something useful with the resultant string.
* The implementer of the Java program that consumes templates can, through
the use of the JETEmitter class, allow users to provider their own
implementations of some or all of the templates
* The generated Java class has no Eclipse dependencies (unless the contained
scriptlets and expressions create these).


EMFT JET (JET2)
* Based on JSP scriptlets AND JSP Tag library concepts
* JET2 plug-ins are complete 'programs'. There is no need to write Java code
to produce a 'code generation' type program (called a JET Transformation)
that runs a set of templates and creates a bunch of files from the template
output, given an input model.
* Each JET2 template is complied into a Java class, and has a generate
method, but the method signature is different:
generate(JET2Context context, JET2Writer out)
* Typically, JET2 users DO NOT WRITE Java classes the consume these template
classes. Instead, they either invoke the JET Transformation using a the
Eclipse UI, or they use a JET API (JET2Platform.runTransformOnXXX()) to
launch the transformation from their Java code.
* A JET Transformation can override another, selectively replacing
templates. This requires no Java programming, just the creation of another
JET Project.
* The generated Java classes have dependencies on the org.eclipse.jet
plug-in, which in turn has dependencies on Eclipse. JET2 templates and
transformations must run with in the Eclipse environment.
* The next release of JET2 will include backward compatible compilation of
"Classic JET" templates. This will be in the Europa release (June 2007)



"Bob Goodman" <goodmanr@us.ibm.com> wrote in message
news:eogp66$s7e$1@utils.eclipse.org...
> I'm trying to use the jet.compile ANT task, but I'm having problem getting
> the generated code.
>
> The ANT task looks like the following
>
> <jet.compile project="org.eclipse.atf.generator"
> destDir="plugins/org.eclipse.atf.generator/src-generated">
> <srcdir dir="plugins/org.eclipse.atf.generator/templates"/>
> </jet.compile>
>
> I get the following messaging print in the output
>
> postFetch:
> [jet.compile] destdir: plugins/org.eclipse.atf.generator/src-generated
> [jet.compile] Compiling: appWizard.javajet
> [jet.compile] Compiling: builder.javajet
> [jet.compile] Compiling: facetInstallDelegate.javajet
> [jet.compile] Compiling: facetUninstallDelegate.javajet
> [jet.compile] Compiling: nature.javajet
> [jet.compile] Compiling: runtimehandler.javajet
> [jet.compile] Compiling: templateContextType.javajet
>
> Everything seems to run correctly, but I don't get the generated code.
>
> Thanks
> Bob
>
>
>
>
>
Re: Problem using jet.compile ANT task [message #489914 is a reply to message #68121] Tue, 06 October 2009 13:31 Go to previous message
No real name is currently offline No real nameFriend
Messages: 14
Registered: September 2009
Junior Member
Hi Bob!

I am trying to use jet.compile to generate code from my JET2 teplates but I can't get it to work. When I put it in my build.xml, it gives me an error saying the class JETCompileTask cannot be found.

How did you use it nd where?

Thanks!
Re: Problem using jet.compile ANT task [message #601322 is a reply to message #68121] Tue, 16 January 2007 16:50 Go to previous message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Bob:

The jet.compile task compiles "JET2" templates. Looking at your build
output, I'd guess that you are using what I would call "Classic JET" - the
JET that is included with EMF.

I think the task you want to use is emf.JETEmitter. See:

http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. emf.doc/references/javadoc/org/eclipse/emf/ant/taskdefs/code gen/JETEmitterTask.html

If you are really using JET2, then you need to add .javajet as an extension
recognized by the compiler on the particular project. See the EMFT JET page
in the project's Properties dialog if that is the case.

FYI, the salient differences between the two are:

Classic JET
* Based on JSP scriptlets <%= ... %> and expressions <% ... %>
* Each template creates a Java class with a single public method:
String generate(Object argument)
* To consume the template, you must write a Java program that instantiates
the generated Java class and calls this method. You must also write any/all
code necessary to so something useful with the resultant string.
* The implementer of the Java program that consumes templates can, through
the use of the JETEmitter class, allow users to provider their own
implementations of some or all of the templates
* The generated Java class has no Eclipse dependencies (unless the contained
scriptlets and expressions create these).


EMFT JET (JET2)
* Based on JSP scriptlets AND JSP Tag library concepts
* JET2 plug-ins are complete 'programs'. There is no need to write Java code
to produce a 'code generation' type program (called a JET Transformation)
that runs a set of templates and creates a bunch of files from the template
output, given an input model.
* Each JET2 template is complied into a Java class, and has a generate
method, but the method signature is different:
generate(JET2Context context, JET2Writer out)
* Typically, JET2 users DO NOT WRITE Java classes the consume these template
classes. Instead, they either invoke the JET Transformation using a the
Eclipse UI, or they use a JET API (JET2Platform.runTransformOnXXX()) to
launch the transformation from their Java code.
* A JET Transformation can override another, selectively replacing
templates. This requires no Java programming, just the creation of another
JET Project.
* The generated Java classes have dependencies on the org.eclipse.jet
plug-in, which in turn has dependencies on Eclipse. JET2 templates and
transformations must run with in the Eclipse environment.
* The next release of JET2 will include backward compatible compilation of
"Classic JET" templates. This will be in the Europa release (June 2007)



"Bob Goodman" <goodmanr@us.ibm.com> wrote in message
news:eogp66$s7e$1@utils.eclipse.org...
> I'm trying to use the jet.compile ANT task, but I'm having problem getting
> the generated code.
>
> The ANT task looks like the following
>
> <jet.compile project="org.eclipse.atf.generator"
> destDir="plugins/org.eclipse.atf.generator/src-generated">
> <srcdir dir="plugins/org.eclipse.atf.generator/templates"/>
> </jet.compile>
>
> I get the following messaging print in the output
>
> postFetch:
> [jet.compile] destdir: plugins/org.eclipse.atf.generator/src-generated
> [jet.compile] Compiling: appWizard.javajet
> [jet.compile] Compiling: builder.javajet
> [jet.compile] Compiling: facetInstallDelegate.javajet
> [jet.compile] Compiling: facetUninstallDelegate.javajet
> [jet.compile] Compiling: nature.javajet
> [jet.compile] Compiling: runtimehandler.javajet
> [jet.compile] Compiling: templateContextType.javajet
>
> Everything seems to run correctly, but I don't get the generated code.
>
> Thanks
> Bob
>
>
>
>
>
Re: Problem using jet.compile ANT task [message #621430 is a reply to message #68121] Tue, 06 October 2009 13:31 Go to previous message
No real name is currently offline No real nameFriend
Messages: 14
Registered: September 2009
Junior Member
Hi Bob!

I am trying to use jet.compile to generate code from my JET2 teplates but I can't get it to work. When I put it in my build.xml, it gives me an error saying the class JETCompileTask cannot be found.

How did you use it nd where?

Thanks!
Previous Topic:could anybody tell me what is 'interface' class?
Next Topic:Framework for Patching EMF Models is available
Goto Forum:
  


Current Time: Fri Apr 19 20:03:02 GMT 2024

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

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

Back to the top