Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » problem running jet.transform task
problem running jet.transform task [message #516774] Thu, 25 February 2010 06:47 Go to next message
Sarvesh  is currently offline Sarvesh Friend
Messages: 10
Registered: August 2009
Junior Member

I am pretty new to running ant headlessly, I have created jet plugin project. now I want to run transformation with xml file as a input. But I am getting error "Could not find resource "TestProject/custom.xml".

I am using Eclipse3.3 (Europa), I have created build file that looks like:

<project name="test" default="test" >
<target name="test">
<jet.transform transformid="com.example.jet.demo" source="TestProject/custom.xml"/>

I have created java project named TestProject that contains model xml ("custom.xml on project's root")
I am using command:
eclipse -data D:\build\Workspace -application org.eclipse.ant.core.antRunner nosplash -buildfile D:\build\build.xml

I have placed my TestProject into D:\build\Workspace directory. here's the exception that occurs..

Caused by: D:\build\build.xml:3: Could not find resource "TestProject/custom.xml".
at org.eclipse.jet.ant.tasks.JETTransformTask.execute(JETTransf
at ava:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
at java.lang.reflect.Method.invoke(
at va:1329)
at )
at org.eclipse.ant.internal.core.ant.EclipseDefaultExecutor.exe cuteTargets(
at 1)

Any idea, what could be wrong?

Thanks in advance!

[Updated on: Thu, 25 February 2010 06:51]

Report message to a moderator

Re: problem running jet.transform task [message #516906 is a reply to message #516774] Thu, 25 February 2010 09:06 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member

You are running your build in the workspace D:\build\Workspace. The
error message means that the projct TestProject cannot be found in that
workspace. You can confirm this by starting Eclipse (with a UI) on that
workspace. If you don't see TestProject, you can import it into the
workspace (File > Import ... General > Existing Projects into Workspace).

My guess is that you want to create C:\build\Workspace as part of your
headless build, and then run the JET transform. For this to work, you
need to import the referenced projects into that workspace, too.
Unfortunately, I do not know of any pre-defined Ant tasks that do this.
However, it should be fairly easy to create one. The key to importing:

1) You would need to pass the tag the location of the project in the
local files system.
2) The tag would then use
ResourcesPlugin.getWorkspace().loadProjectDescription() [1]
3) To then import the project, you would create an IProject handle
using: ResourcesPlugin.getWorkspace().getRoot().getProject() [2]. You'd
pass the value returned by IProjectDescription.getName().
4) Finally, use IProject.create(IProjectDescription,IProgressMonitor)
[3] to complete the import.

If you have never created a custom Ant task for Eclipse, see:
* Contributing tasks and types [4]
* Developing Ant tasks and types within Eclipse [5]

[1] loadProjectDescription -
( oc.isv/reference/api/org/eclipse/core/resources/IWorkspace.h tml#loadProjectDescription(org.eclipse.core.runtime.IPath)
[2] c.isv/reference/api/org/eclipse/core/resources/IWorkspaceRoo t.html#getProject(java.lang.String)

[3] c.isv/reference/api/org/eclipse/core/resources/IProject.html #create (org.eclipse.core.resources.IProjectDescription,%20org.eclip se.core.runtime.IProgressMonitor)
[4] platform.doc.isv/guide/ant_contributing_task.htm
[5] platform.doc.isv/guide/ant_developing.htm
Re: problem running jet.transform task [message #517072 is a reply to message #516906] Fri, 26 February 2010 04:41 Go to previous message
Sarvesh  is currently offline Sarvesh Friend
Messages: 10
Registered: August 2009
Junior Member
Thank you very much Paul!

After importing the project manually it works.
Now I will create custom ant task to import the projects into workspace.

Thanks once again!
Previous Topic:[xtend] instanceof
Next Topic:UML2 Profile Types Not Found
Goto Forum:

Current Time: Wed Apr 25 22:28:38 GMT 2018

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

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