Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » How to implement <jet.compile2> using customBuildCallbacks.xml
How to implement <jet.compile2> using customBuildCallbacks.xml [message #490492] Thu, 08 October 2009 19:59 Go to next message
No real name is currently offline No real nameFriend
Messages: 14
Registered: September 2009
Junior Member
I am trying to generate code from my JET2 templates. I found a patch to <jet.compile> from https://bugs.eclipse.org/bugs/show_bug.cgi?id=210447#c1.

I updated my build.properties as follows:
customBuildCallbacks=true
customBuildCallbacks.failonerror=true
customBuildCallbacks.inheritall=true

I updated customBuildCallbacks.xml as follows:

<target name="pre.@dot">
<jet.compile2 projectDir="${basedir}" destdir="src">
<src dir="." includes="/templates/*.*"/>
</jet.compile2>
</target>

Then I regenerated my build.xml (using File->Export->Ant build files) from within eclipse IDE. But I do not see any subant tasks to reflect the changes that I made to build.properties and customBuildCallbacks.xml.

Is this the way to do it? Do I need to do anything differently?

Any help/suggestions will be appreciated. I am pretty new to this and am struggling with this right now.

Thanks!
Re: How to implement <jet.compile2> using customBuildCallbacks.xml [message #491158 is a reply to message #490492] Tue, 13 October 2009 13:39 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Can we take a step back from the code, and answer a few questions:

1) What is your objective is using Ant to compile your JET templates?

2) What version of Eclipse and JET are you using?

Also, lets try an keep the discussion to a single thread. Future readers will have a much easier time following things if we do.

Paul
Re: How to implement <jet.compile2> using customBuildCallbacks.xml [message #491167 is a reply to message #491158] Tue, 13 October 2009 14:18 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 14
Registered: September 2009
Junior Member
Thanks for your response.

1. My objective is to generate code from JET2 templates independant of eclipse. Ant was the only solution that I could find.

2. I tested on eclipse 3.5 & jet 1.0.1 and eclipse 3.4 & jet 0.8.1

Sorry for having posted on different threads. I am really desperate for a solution.

Thanks!
Re: How to implement <jet.compile2> using customBuildCallbacks.xml [message #491381 is a reply to message #490492] Wed, 14 October 2009 12:07 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Gincy.z.varghese.accentur wrote on Thu, 08 October 2009 15:59
I am trying to generate code from my JET2 templates.


I'd like to understand what you have been successful in doing. So, excuse me if some of these questions seem silly...

1) Have you created a JET project by using the New JET Transformation Project.

This setups an Eclipse project with the JET builder so that .jet files automatically get compiled into Java classes. If you have such a project, you don't need the <jet.compile> task.

(Incidentally, these Java classes are hidden by default. To see them in the Package Explorer, click the little white downward pointing triangle in the top left corner of the Package Explorer and choose Filters. Then check Java elements from JET Transformation projects.

2) Have you created test input so that your templates have something to run against?

As you're new with this, I'd expect you would be using either an XML document or perhaps an instance of an model defined with EMF.

3) Have you code the JET project's main.jet template to invoke your templates? You should be using tags such as <ws:file> do invoke a template and direct its output to a file in the Eclipse workspace.

4) Have you tested your JET project (aka Transformation) on your test input by creating a run configuration:
a) Click Run > Run Configurations
b) In the left-hand tree, select JET Transformation, then click the 'New' icon.
c) Browse for your test input file as the Transformation Input
d) Select your JET project from the ID combo box
e) Click Run.


The following article gives a good introduction to doing the above:

http://www.ibm.com/developerworks/opensource/library/os-ecl- jet/


Paul
Re: How to implement <jet.compile2> using customBuildCallbacks.xml [message #491385 is a reply to message #491381] Wed, 14 October 2009 12:21 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 14
Registered: September 2009
Junior Member
I have an eclipse project with jet.transform. Within eclipse IDE, these java files get generated successfully from JET2 templates and I can see them in the package explorer view. But we do not archive these generated files.

During a command line build, we would like to get the latest project from the archive (which will not include the files generated from the templates), generate these files (from command line) from the JET2 templates and then do a maven build.

With JET templates, I was able to do this successfully using the custom task jetc.

Please let me know if you need any further clarifications.

Thanks!
Re: How to implement <jet.compile2> using customBuildCallbacks.xml [message #491453 is a reply to message #491385] Wed, 14 October 2009 16:03 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 14
Registered: September 2009
Junior Member
Sorry, I forgot to add the information about what I had been successful in doing so far:

For JET2, I was able to use jet.compile successfully when my project was within an eclipse workspace but does not work when the project is not included within one.

I saw <jet.compile2> as a patch for the above issue and tried to use it. This works fine on eclipse 3.3 and jet 0.8.1 independant of eclipse.

But <jet.compile2> gives me null pointer exceptions on eclipse 3.5 & jet 1.0.1 and eclipse 3.4 & jet 0.8.1 irrespective of whether the project is included within an eclipse workspace or not.

This happens because getProject() returns null. While reading up on this issue, I found that there is a certain way to build custom ant tasks. Since I am new to eclipse, I am not sure how or what changes to make to org.eclipse.examples.jet.ant.

Any help will be appreciated.
Thanks!
Re: How to implement <jet.compile2> using customBuildCallbacks.xml [message #491944 is a reply to message #491453] Fri, 16 October 2009 16:26 Go to previous message
No real name is currently offline No real nameFriend
Messages: 14
Registered: September 2009
Junior Member
Any solutions for this issue?

It works fine for me when I run the java command with eclipse 3.3 startup.jar but fails when I run the same command to build the same project using eclipse 3.5 equinox launcher.

Thanks!
Previous Topic:How to define Xtend method like: collection.retainAll(e|expression with e) ?
Next Topic:Any update site for plugin org.eclipse.emf.mwe.ewm.core ?
Goto Forum:
  


Current Time: Thu Apr 25 15:24:08 GMT 2024

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

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

Back to the top