Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » ANT Task for JET
ANT Task for JET [message #40637] Mon, 21 January 2008 21:02 Go to next message
Eclipse UserFriend
Originally posted by: vts1018.hotmail.com

I am trying to use custom ANT tasks to perform JET-to-Java transformation
as specified in this jet tutorial
( http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. emf.doc/tutorials/jet2/jet_tutorial2.html)
for a sample/default JET project (with main.jet and dump.jet templates)

I have got the ANT environment setup and custom task configured and
running, but am still getting some runtime errors. My build.xml is:

<project default="jetc_multiple_templates">
<property name="eclipse.plugins.dir" location="C:\opt\eclipse\plugins" />

<taskdef name="jetc" classname="ch.paranor.epla.structure.JETCTask">
<classpath>
<pathelement location="jetc-task.jar" />
<fileset dir="${eclipse.plugins.dir}">

<!-- since there are some ClassNotFound errors, temporarely include all
eclipse .jars -->
<include name="*.jar" />
</fileset>
</classpath>
</taskdef>

<!-- Translate a bunch of template files at once. -->
<!-- You cannot use the "class" and "package" attributes when using a
fileset. -->
<target name="jetc_multiple_templates">
<mkdir dir="jet-output" />
<jetc destdir="jet-output">
<fileset dir="C:\dev\EclipseWorkspace\Jet2Java\templates\"
includes="*.*jet" />
</jetc>
<javac srcdir="jet-output" destdir="classes" />
</target>
</project>

and the error(s) that I am get are:

C:\dev\EclipseWorkspace\Jet2Java>ant
Buildfile: build.xml

jetc_multiple_templates:
[jetc] Compiling 1 JET template(s) to
C:\dev\EclipseWorkspace\Jet2Java\jet-output

BUILD FAILED
C:\dev\EclipseWorkspace\Jet2Java\build.xml:34:
java.lang.IllegalStateException: Workspace is closed.

Total time: 4 seconds

Has anyone else faced this problem? Is anyone else using this approach to
automate JET to Java transformation?
Re: ANT Task for JET [message #40949 is a reply to message #40637] Thu, 24 January 2008 16:06 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Robert:

You need to be using the Eclipse Ant runner. That is, you launch Eclipse
with '-application org.eclipse.ant.core.AntRunner' on the command line. You
can also include '-data ...' to specify the Eclipse workspace location. The
rest of the command line is your standard Ant command line.

A side-effect of using the Eclipse ant runner is that you do not need to do
any <taskdef> stuff, nor fool around with the eclipse plug-ins, etc...

If you want to test your Ant build script from within Eclipse, make sure the
the Ant configuration has the JRE set to 'Run in same JRE as the workspace'.

I have some ideas on making the jet.compile task independent of Eclipse, but
it is not likely to happen during this release.

Hope this helps.

Paul
"Robert Smith" <vts1018@hotmail.com> wrote in message
news:886e97a48712c4aa13ddc5d9320e6843$1@www.eclipse.org...
>I am trying to use custom ANT tasks to perform JET-to-Java transformation
>as specified in this jet tutorial
>( http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. emf.doc/tutorials/jet2/jet_tutorial2.html)
>for a sample/default JET project (with main.jet and dump.jet templates)
>
> I have got the ANT environment setup and custom task configured and
> running, but am still getting some runtime errors. My build.xml is:
>
> <project default="jetc_multiple_templates">
> <property name="eclipse.plugins.dir" location="C:\opt\eclipse\plugins" />
> <taskdef name="jetc" classname="ch.paranor.epla.structure.JETCTask">
> <classpath>
> <pathelement location="jetc-task.jar" />
> <fileset dir="${eclipse.plugins.dir}">
>
> <!-- since there are some ClassNotFound errors, temporarely include all
> eclipse .jars -->
> <include name="*.jar" />
> </fileset>
> </classpath>
> </taskdef>
>
> <!-- Translate a bunch of template files at once. -->
> <!-- You cannot use the "class" and "package" attributes when using a
> fileset. -->
> <target name="jetc_multiple_templates">
> <mkdir dir="jet-output" />
> <jetc destdir="jet-output">
> <fileset dir="C:\dev\EclipseWorkspace\Jet2Java\templates\"
> includes="*.*jet" />
> </jetc>
> <javac srcdir="jet-output" destdir="classes" />
> </target>
> </project>
>
> and the error(s) that I am get are:
>
> C:\dev\EclipseWorkspace\Jet2Java>ant
> Buildfile: build.xml
>
> jetc_multiple_templates:
> [jetc] Compiling 1 JET template(s) to
> C:\dev\EclipseWorkspace\Jet2Java\jet-output
>
> BUILD FAILED
> C:\dev\EclipseWorkspace\Jet2Java\build.xml:34:
> java.lang.IllegalStateException: Workspace is closed.
>
> Total time: 4 seconds
>
> Has anyone else faced this problem? Is anyone else using this approach to
> automate JET to Java transformation?
>
>
Re: ANT Task for JET [message #41445 is a reply to message #40949] Thu, 07 February 2008 13:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: christian_sarrasin.ml.com

Hi Paul,

What about running the ANT buildfile straight from within Eclipse
(rightclick on build.xml->RunAs->Ant build), do I still require that Ant
Runner command line?

At the moment I'm getting this:

BUILD FAILED
...\build\build.xml:47: Problem: failed to create task or type
jet.transform
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken
place.

Is there a way around this that will not require me to run a second
Eclipse instance for just this purpose?

I can see lots of questions around this topic (running JET transforms from
Ant); perhaps it would be worthy an entry in your excellent Wiki FAQ

Many thanks for all your help!
Christian
Re: ANT Task for JET [message #41496 is a reply to message #41445] Thu, 07 February 2008 14:12 Go to previous message
Dave Carlson is currently offline Dave CarlsonFriend
Messages: 402
Registered: July 2009
Senior Member
Christian,
When running a contributed Ant task within the workspace, you must choose
the option to run in the same JRE, else the Ant task declaration is not
found.

-- Right-click on the build.xml and select "Run As > External Tools..."
-- In the dialog, on the JRE tab, select "Run in same JRE as workspace"

Regards,
Dave Carlson

"Christian Sarrasin" <christian_sarrasin@ml.com> wrote in message
news:ffc15ad63a6cf270b8a304ff22d4868f$1@www.eclipse.org...
> Hi Paul,
>
> What about running the ANT buildfile straight from within Eclipse
> (rightclick on build.xml->RunAs->Ant build), do I still require that Ant
> Runner command line?
Previous Topic:UnitTest for custom tags
Next Topic:debugging one's custom tags
Goto Forum:
  


Current Time: Fri Apr 19 11:01:40 GMT 2024

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

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

Back to the top