Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Building JET2 files using ANT
Building JET2 files using ANT [message #31017] Tue, 14 August 2007 15:43 Go to next message
Eclipse UserFriend
Originally posted by: danyiel.us.ibm.com

Hello,

I have created many JET2 files and now I need to build them into a .jar
file. How do you build JET files using ANT? How you do compile JET2
templates files? The output should be the same as exporting the
templates as deployable plug-ins when developing in eclipse.

Thank you,
Danyiel
Re: Building JET2 files using ANT [message #31156 is a reply to message #31017] Tue, 14 August 2007 20:22 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: danyiel.us.ibm.com

Danyiel Louis wrote:
> Hello,
>
> I have created many JET2 files and now I need to build them into a .jar
> file. How do you build JET files using ANT? How you do compile JET2
> templates files? The output should be the same as exporting the
> templates as deployable plug-ins when developing in eclipse.
>
> Thank you,
> Danyiel


Hello,
I am planning to jet the jet.compile ANT task to compile my JET2
templates. See this website:
http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. jet.doc/references/ant/antTasks.xhtml
on Ant tasks provided by JET.
My question is where is the jet.compile class file? I get an error
when using this Ant task. Should I define the task using taskdef? What
jar file I am missing here? Here is the error I receive:

Ant could not find the task or a class this task relies upon.

This is common and has a number of causes; the usual
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file:
- You have misspelt 'jet.compile'.
Fix: check your spelling.
- The task needs an external JAR file to execute
and this is not found at the right place in the classpath.
Fix: check the documentation for dependencies.
Fix: declare the task.
- The task is an Ant optional task and the JAR file and/or libraries
implementing the functionality were not found at the time you
yourself built your installation of Ant from the Ant sources.
Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the
task and make sure it contains more than merely a
META-INF/MANIFEST.MF.
If all it contains is the manifest, then rebuild Ant with the needed
libraries present in ${ant.home}/lib/optional/ , or alternatively,
download a pre-built release version from apache.org
- The build file was written for a later version of Ant
Fix: upgrade to at least the latest release version of Ant
- The task is not an Ant core or optional task
and needs to be declared using <taskdef>.
- You are attempting to use a task defined using
<presetdef> or <macrodef> but have spelt wrong or not
defined it at the point of use

Remember that for JAR files to be visible to Ant tasks implemented
in ANT_HOME/lib, the files must be in the same directory or on the
classpath


Thanks for the help.

Danyiel
Re: Building JET2 files using ANT [message #31470 is a reply to message #31156] Mon, 27 August 2007 13:34 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Danyiel:

The jet.compile task requires the Eclipse ant runner:

eclipse -application org.eclipse.ant.core.antRunner ...ant command-line
arguments...

Also, there are ways to integrate JET template compilation in with PDE build
(the Eclipse plug-in development environment ant-based build mechanism). Let
me know if you're using PDE build, and I'll dig up the details.

Paul

"Danyiel Louis" <danyiel@us.ibm.com> wrote in message
news:f9t2t8$mhv$1@build.eclipse.org...
> Danyiel Louis wrote:
>> Hello,
>>
>> I have created many JET2 files and now I need to build them into a .jar
>> file. How do you build JET files using ANT? How you do compile JET2
>> templates files? The output should be the same as exporting the
>> templates as deployable plug-ins when developing in eclipse.
>>
>> Thank you,
>> Danyiel
>
>
> Hello,
> I am planning to jet the jet.compile ANT task to compile my JET2
> templates. See this website:
> http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. jet.doc/references/ant/antTasks.xhtml
> on Ant tasks provided by JET.
> My question is where is the jet.compile class file? I get an error when
> using this Ant task. Should I define the task using taskdef? What jar
> file I am missing here? Here is the error I receive:
>
> Ant could not find the task or a class this task relies upon.
>
> This is common and has a number of causes; the usual
> solutions are to read the manual pages then download and
> install needed JAR files, or fix the build file:
> - You have misspelt 'jet.compile'.
> Fix: check your spelling.
> - The task needs an external JAR file to execute
> and this is not found at the right place in the classpath.
> Fix: check the documentation for dependencies.
> Fix: declare the task.
> - The task is an Ant optional task and the JAR file and/or libraries
> implementing the functionality were not found at the time you
> yourself built your installation of Ant from the Ant sources.
> Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the
> task and make sure it contains more than merely a
> META-INF/MANIFEST.MF.
> If all it contains is the manifest, then rebuild Ant with the needed
> libraries present in ${ant.home}/lib/optional/ , or alternatively,
> download a pre-built release version from apache.org
> - The build file was written for a later version of Ant
> Fix: upgrade to at least the latest release version of Ant
> - The task is not an Ant core or optional task
> and needs to be declared using <taskdef>.
> - You are attempting to use a task defined using
> <presetdef> or <macrodef> but have spelt wrong or not
> defined it at the point of use
>
> Remember that for JAR files to be visible to Ant tasks implemented
> in ANT_HOME/lib, the files must be in the same directory or on the
> classpath
>
>
> Thanks for the help.
>
> Danyiel
Re: Building JET2 files using ANT [message #35036 is a reply to message #31470] Fri, 12 October 2007 11:01 Go to previous messageGo to next message
Henrik  önsson is currently offline Henrik önssonFriend
Messages: 53
Registered: July 2009
Member
Hi,

I'm using PDE Build and would like to get some details how to build JET
templates during with this.

Regards

Henrik
Re: Building JET2 files using ANT [message #35071 is a reply to message #35036] Fri, 12 October 2007 13:16 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Henrik:

The trick is to use the PDE's custom build callbacks capabilities, where are
described in general here:

http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. pde.doc.user/guide/tasks/pde_custom_callbacks.htm

For a JET transformation/plug-in, you put the ANT task in the pre.@dot
target, and you make a customBuildCallbacks entry in build.properties. And,
of course, the Eclipse environment used to run the build must include JET.

Here is a sample pre.@dot target from a customBulidCallbacks.xml:

<target name="pre.@dot">

<jet.compile project="custom.bean.generator" destdir="jet2java" >

<srcdir dir="." includes="templates/**/*.jet"/>

</jet.compile>

</target>


I've attached examples of customBuildCallbacks.xml and build.properties for
a JET project.

Paul


"Henrik "J
Re: Building JET2 files using ANT [message #36207 is a reply to message #35071] Thu, 15 November 2007 11:27 Go to previous messageGo to next message
Henrik  önsson is currently offline Henrik önssonFriend
Messages: 53
Registered: July 2009
Member
Thanks for the details!

Do I need to do something more in order to get the "deployable" jar or
does PDE Build take care of this?

Regards

Henrik
Re: Building JET2 files using ANT [message #36275 is a reply to message #36207] Thu, 15 November 2007 13:32 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
PDE Build should take care of the rest.

Paul

"Henrik "J
Re: Building JET2 files using ANT [message #36308 is a reply to message #36275] Fri, 16 November 2007 14:58 Go to previous messageGo to next message
Henrik  önsson is currently offline Henrik önssonFriend
Messages: 53
Registered: July 2009
Member
Hi again.

As I said eariler, I have a headless PDE product build that I would like
to build our JET files in.

I can't get the ant compile task to work. Maybe I'm doing something wrong.

Here's my ant code:
<target name="pre.@dot">
<echo message="*** Compiling JET for
com.bombardier.rbc.sitedata.export.adaptation_bv.bundle1" />
<jet.compile
project="com.bombardier.rbc.sitedata.export.adaptation_bv.bundle1 "
destdir="src">
<srcdir dir="." includes="templates/*.jet" />
</jet.compile>
</target>

My callback is run, but fails in the compile task. This is the error
message I get from the compile task:
project does not exist

I looked in the source code for the compile task and found this:
public void setProject(String eclipseProject) {
this.eclipseProject =
ResourcesPlugin.getWorkspace().getRoot().getProject(eclipseP roject);
}

private void validate() {
if(destdir == null) throw new BuildException("destdir not set");
if(srcFilesets.size() == 0) throw new BuildException("srcdir not set");
if(eclipseProject == null) throw new BuildException("project not
set");
if(!eclipseProject.exists()) throw new BuildException("project does not
exist");
if(!eclipseProject.isOpen()) throw new BuildException("project is not
open");
}

It looks like eclipseProject must available in my workspace. I'm no expert
in PDE Build, but I don't think I have a workspace there.

Regards

Henrik
Re: Building JET2 files using ANT [message #36730 is a reply to message #36308] Tue, 20 November 2007 14:49 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Henrik:

I'll investigate today and report back.

Paul

"Henrik "J
Re: Building JET2 files using ANT [message #36798 is a reply to message #36308] Tue, 20 November 2007 20:55 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Henrik:

Based on your comments (and my general ignorance of the details of PDE
build), I'm guessing that jet.compile may not work with PDE build after all.

As you note, jet.compile assumes that the project being compiled is in the
workspace. If the plug-ins being build are not in the workspace (this makes
sense, in thinking about it), then this approach will not work.

Unfortunately, there is no good alternative at this point. The best I can
suggest is:

* Modify the JET project's settings so that generated Java classes are not
marked as derived (Clear the "Hide compiled Java from Team ssytem" check
box).
* Check-in the generated .java classes.
* Remove the custombuildcallback from the build.
* Do a normal PDE build.

I have created bug 210447 to track this:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=210447

Paul

"Henrik "J
Re: Building JET2 files using ANT [message #36832 is a reply to message #36798] Wed, 21 November 2007 13:19 Go to previous messageGo to next message
Henrik  önsson is currently offline Henrik önssonFriend
Messages: 53
Registered: July 2009
Member
Hi,

How deep inside the JET compiler is the depenency on a workspace required?
Do you have any idea how to solve this?

I guess this is not that critical for you at the moment, but we need this
badly. If you don't have the time to implement it maybe I could do it.

Regards

Henrik
Re: Building JET2 files using ANT [message #36867 is a reply to message #36832] Wed, 21 November 2007 14:03 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Henrik:

I'll take a look at this this week, and try to figure out what is needed.
I'll add what I find to the bugzilla. And, of course, contributions are
always welcome.

Paul

"Henrik "J
Re: Building JET2 files using ANT [message #36969 is a reply to message #36832] Wed, 28 November 2007 13:48 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
All:

I have attached a partial test fix to the bug. See:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=210447#c1

And, please leave any feedback as a comment on the bug.

Paul

"Henrik "J
Re: Building JET2 files using ANT [message #490154 is a reply to message #36969] Wed, 07 October 2009 14:56 Go to previous message
No real name is currently offline No real nameFriend
Messages: 14
Registered: September 2009
Junior Member
Hi Paul,

Since jet.compile did not work for me when the project was not inside the eclipse workspace, I downloaded your patch, built it as a separate jar (org.eclipse.jet.examples.ant_0.9.0.jar), and copied it to the eclipse plugins directory.

I updated build.xml to call jet.compile2 and ran it using the following java command:
C:\Build\Tools\com.accenture.tools.tabbed>java -Xms128m -Xmx1024m -XX:MaxPermSize=256m -jar C:\Opt\eclipse\plugins\org.eclipse.equin
ox.launcher_1.0.200.v20090520.jar -application org.eclipse.ant.core.antRunner -data C:\Build\Tools -f C:\Build\Tools\com.accenture.t
ools.tabbed\build.xml jet2_multiple_templates.

The first time I ran it, it was successful. It generated the .java files from the templates. Without making any changes, I cleaned up the project and ran the java command again. It gave me null pointer exceptions.

I then deleted org.eclipse.jet.examples.ant project from my workspace, re-imported it and built it again. After this, the java command ran successfully the first time but gave null pointer exceptions after that.

Any idea why this is happening?
Is this how we are supposed to apply this patch or should we integrate it with org.eclipse.jet.source project?

Any help or suggestions will be appreciated.

Thanks!
Previous Topic:<jet.compile> generates files under wrong directory
Next Topic:Reading Multiple XML files with Xpand
Goto Forum:
  


Current Time: Mon Dec 30 16:47:29 GMT 2024

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

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

Back to the top