Jump to: navigation, search

Difference between revisions of "JET FAQ Why do I get errors stating variable 'org.eclipse.jet.resource.project.name' is undefined?"

m (Answer)
m (Answer)
 
Line 29: Line 29:
 
JET2Platform.runTransformOnString( transformID, yourXMLAsString, "xml", variables, monitor);
 
JET2Platform.runTransformOnString( transformID, yourXMLAsString, "xml", variables, monitor);
 
</pre></code>
 
</pre></code>
 +
 +
 +
Back to the [[M2T-JET-FAQ]]
 +
 +
[[Category:Modeling]][[Category:M2T]]

Latest revision as of 08:53, 11 July 2007

Question

I created an EMFT JET transformation project (the id is "my.jet.transformation") without any change and it worked perfectly via the run JET Transformation dialog.

Then I created a test plug-in to execute the transformation. The running result is very weird for it threw a "java.lang.NoClassDefFoundError: org/eclipse/jet/JET2Platform" exception in JET2 0.7.1 while an error message of "Variable "org.eclipse.jet.resource.project.name" is not defined." in JET2 0.8.0 (during debuging).

Answer

The default transformation project has the following tag in main.jet:

<ws:file template="templates/dump.jet" path="{$org.eclipse.jet.resource.project.name}/dump.xml"/>

This dumps the transformations input model to a file dump.xml in the root of the project containing the input.

But, when you use runTransformOnString, there is not project containing the input model. You have the following choices

  1. remove the above tag
  2. Change the {$org.eclipse.jet.resource.project.name} part to something that is dependent on data in the model itself
  3. Pass a value for org.eclipse.jet.resource.project.name into runTransformOnString...
Map arguments = new HashMap();
arguments.put("org.eclipse.jet.resource.project.name", "Some Known Project Name");
JET2Platform.runTransformOnString( transformID, yourXMLAsString, "xml", variables, monitor);


Back to the M2T-JET-FAQ