Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
JET FAQ Why do I get errors stating variable 'org.eclipse.jet.resource.project.name' is undefined?
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
- remove the above tag
- Change the {$org.eclipse.jet.resource.project.name} part to something that is dependent on data in the model itself
- 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