Community
Participate
Working Groups
Created attachment 205925 [details] Example project I attached a project containing a genmodel and a ATL transformation. When starting the ATL transformation manually the line propertyDescription <- s.ecoreFeature.name.debug('name') returns name: 'BugAttribute' When starting via the ant skript it returns name: OclUndefined This has somehow to do that s.ecoreFeature is a cross reference from the genmodel to the ecore model.
Changed to major as it only concerns ant launch.
Created attachment 241708 [details] Another example where inter model references fails with ant Here comes another example using UML metamodel. The problems occures with models using external ones. The option "allowInterModelReferences" of the "EMF-specific VM" is set. All is OK when using a manual launch (Runs As configuration), but the external sub-model is not seen when using an ant task.
Created attachment 241956 [details] Patch for allowing use of platform: path in ant tasks The problem mainly comes from EMF rather than from ATL. To properly load a main model (intermodel in our example) with an external model component (external in our example), the class org.eclipse.emf.ecore.resource.impl.ResourceImpl needs at least one of the two xml files containing the models to be designated by a workspace relative path (in our example, platform:/resource/InterModelExample/interModelReference.uml or platform:/resource/InterModelExample/externalModel.uml). Note that the second path is given as an href attribute within the first main xml model file. In our example, the URL of the external component is given as "externalModel.uml", not as "platform:/resource/InterModelExample/externalModel.uml". So, to have the ATL transformation to work we must - either edit the interModelReference.uml file to replace the two occurrences of "externalModel.uml" by "platform:/resource/InterModelExample/externalModel.uml"; - or make ATL access to the main model file using the pass "platform:/resource/InterModelExample/interModelReference.uml" (what is naturally made by the ATL UI when using a "Run Configuration), but is currently impossible using ATL ant tasks). A solution would be to allow ATL ant tasks to use platform: URLs. This imply to modify two lines of code. 1- In org.eclipse.m2m.atl.core.ant.tasks.LoadModelTask.java within the private String convertSource() method, replace { return "file:/" + path.toString(); } by { String pathString = path.toString(); if (pathString.contains("platform:")) return pathString.substring(pathString.indexOf("platform:")).replaceAll("\\\\", "/"); else return "file:/" + pathString; } 2- In org.eclipse.m2m.atl.core.ant.tasks.SaveModelTask.java within the private String convertTarget() method, make the same replacement. We now can use a platform: path in the atl.loadModel and atl.saveModel taskslike : <project name="InterModelReferenceTask" default="run"> <property name="inputModelPath" value="platform:/resource/InterModelExample/interModelReference.uml" /> <property name="outputModelPath" value="platform:/resource/InterModelExample/interModelReferenceOutput.uml" /> <target name="run"> <atl.loadModel name="UML" metamodel="MOF" nsUri="http://www.eclipse.org/uml2/4.0.0/UML" /> <atl.loadModel name="inputModel" metamodel="UML" path="${inputModelPath}" /> <atl.launch path="InterModelReferences.asm" refining="true"> <option name="allowInterModelReferences" value="true" /> <inoutmodel model="inputModel" name="IN" /> </atl.launch> <atl.saveModel model="inputModel" path="${outputModelPath}" /> </target> </project> Here included in Patch.zip the new example, the two patched files and the patched atlAntTasks.jar to replace the one in the org.eclipse.m2m.atl.core.ant_3.4.0.v201305211502.jar plugin.
Finally not a real bug. Solved replacing path attribute by nsUri attribute in the atl.loadModel tag as suggested in https://bugs.eclipse.org/bugs/show_bug.cgi?id=297718