Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Executing an ant build file programmatically which, in turn, executes an etl transformation
Executing an ant build file programmatically which, in turn, executes an etl transformation [message #1787370] Thu, 24 May 2018 08:09 Go to next message
Davide Arcelli is currently offline Davide ArcelliFriend
Messages: 7
Registered: May 2018
Junior Member
Dear all,
I am trying to programmatically execute an ant build file which, in turn, executes an etl transformation (from UML to a dsl in ecore).

I report in the following a minimal excerpt of the project within the build file (please notice that several other taskdef are defined and invoked, i.e. epsilon.emf.register, epsilon.emf.loadMode and epsilon.storeModel, which are not reported because they work well):

<target name="loadModels">
	...
	<taskdef name="epsilon.etl" classname="org.eclipse.epsilon.workflow.tasks.EtlTask">
		<classpath>
	        <pathelement location=".../lib/epsilon-1.4-workflow-emf.jar"/>
			<pathelement location="/.../lib/epsilon-1.4-workflow.jar"/>
			<pathelement location=".../plugins/org.eclipse.epsilon.eol.engine_1.4.0.201611012202.jar"/>
			<pathelement location=".../plugins/org.eclipse.epsilon.etl.engine_1.4.0.201611012202.jar"/>
			<pathelement location=".../plugins/org.eclipse.epsilon.common_1.4.0.201611012202.jar"/>
			<pathelement location=".../ plugins/org.eclipse.epsilon.erl.engine_1.4.0.201611012202.jar"/>
		</classpath> 
	</taskdef>
	...
</target>
<target name="targetModels" depends="loadModels">	
	<epsilon.etl src=".../transformation.etl" >
		<model ref="UML"/>
		<model ref="target" />
	</epsilon.etl>
	<epsilon.storeModel model="target"/>
	...
</target>



Minimal code for executing the ant build above is reported in the following:

...
File file = new File(buildXmlFileFullPath);
Project project = new Project();
project.init(); 		
DefaultLogger logger = new DefaultLogger();
...		
project.setProperty("ant.file", file.getAbsolutePath());
project.addBuildListener(logger);
project.fireBuildStarted(); 		
ProjectHelper helper = ProjectHelper.getProjectHelper();
project.addReference("ant.projectHelper", helper);
helper.parse(project, file);
project.executeTarget(target);




The etl transformation starts as follows:

pre {
	"Transforming UML model TO target model ".print();
	var profiler : new Native('org.eclipse.epsilon.eol.tools.ProfilerTool');
	profiler.start('BatchProgram');
}
...



Here is what I obtain by executing the java code:

[epsilon.etl - transformation.etl] Line: 2, Column: 50, Reason: mismatched input: ';'

As a result, I obtain an empty target model resulting from the epsilon.storeModel task that follows epsilon.etl in the ant build file (notice that the ant is built successfully). Hence, the transformation is not executed probably due to some parsing issues.

Could anyone please help on this? Many thanks in advance.

Cheers,
Davide.
Re: Executing an ant build file programmatically which, in turn, executes an etl transformation [message #1787483 is a reply to message #1787370] Sat, 26 May 2018 09:39 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1612
Registered: July 2009
Location: York, UK
Senior Member

Hi Davide,

Could you please provide a minimal example [1] I can use to reproduce this locally?

Cheers,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/articles/minimal-examples/
Re: Executing an ant build file programmatically which, in turn, executes an etl transformation [message #1787542 is a reply to message #1787483] Mon, 28 May 2018 13:34 Go to previous messageGo to next message
Davide Arcelli is currently offline Davide ArcelliFriend
Messages: 7
Registered: May 2018
Junior Member
Dear Dimitris,

thank you for your reply.
After preparing a minimal example, I figured out that the latter works. Probably my problem was related to classpath and it will emerge again when I will integrate the standalone example in my main project.
However, now I am facing another problem, i.e. I cannot load MARTE profile programmatically. In fact, as you can see in the minimal example here attached, both the two output files from the etl transformation are created (i.e. the target model and the trace model), but they are not properly filled due to the fact that the operation called at line 46 of the etl transformation rule, i.e. getUseCases(), looks for UML UseCases with <<GaScenario>> MARTE GQAM stereotype applied; this should mean that the MARTE profile is not properly loaded. Could you please help me on this, although it is not strictly related to Epsilon?

thank you in advance and best regards,
Davide
Re: Executing an ant build file programmatically which, in turn, executes an etl transformation [message #1787543 is a reply to message #1787483] Mon, 28 May 2018 13:34 Go to previous messageGo to next message
Davide Arcelli is currently offline Davide ArcelliFriend
Messages: 7
Registered: May 2018
Junior Member
I forgot to attach the minimal example, sorry :)

Best regards,
Davide

[Updated on: Mon, 28 May 2018 13:36]

Report message to a moderator

Re: Executing an ant build file programmatically which, in turn, executes an etl transformation [message #1787633 is a reply to message #1787543] Wed, 30 May 2018 10:45 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 476
Registered: January 2010
Senior Member
I believe that your example project does not include the Papyrus MARTE profile implementation. Let me try and tweak your example a bit :-).
Re: Executing an ant build file programmatically which, in turn, executes an etl transformation [message #1787637 is a reply to message #1787633] Wed, 30 May 2018 11:30 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 476
Registered: January 2010
Senior Member
I have tweaked your example project, and it seems to be working now :-).

Basically, I added the .jar with the MARTE GQAM package implementation to the classpath, and then I used the ExtensionProcessor from EMF UML2 to register the profiles properly (there are a few things to set up beyond the basic EMF infra). Simply registering the GQAM package in the EPackageRegistry is not enough.

It produces a few warnings here about multiply defined packages, but otherwise it is working instances in the target models. The ExtensionProcessor is basically taking care of reading the plugin.xml files in the classpath and handling those as if we were inside Eclipse.
Re: Executing an ant build file programmatically which, in turn, executes an etl transformation [message #1787639 is a reply to message #1787637] Wed, 30 May 2018 11:31 Go to previous messageGo to next message
Antonio Garcia-Dominguez is currently offline Antonio Garcia-DominguezFriend
Messages: 476
Registered: January 2010
Senior Member
Specifically, I changed this bit in your Launcher:

	public static void runBuild() throws CoreException {
		ExtensionProcessor.process(Launcher.class.getClassLoader());
		String dir = "resources/transformations/antlaunch/forward/";
		String completePath = dir + "build.xml";
		File buildFile = new File(completePath);
		launching.AntExecutor.executeAntTask(buildFile.getAbsolutePath(), "targetModels");
	}
Re: Executing an ant build file programmatically which, in turn, executes an etl transformation [message #1789959 is a reply to message #1787639] Fri, 01 June 2018 08:18 Go to previous messageGo to next message
Davide Arcelli is currently offline Davide ArcelliFriend
Messages: 7
Registered: May 2018
Junior Member
It works, now!
Many many thanks, Antonio! :)

Best regards,
Davide.
Re: Executing an ant build file programmatically which, in turn, executes an etl transformation [message #1790158 is a reply to message #1789959] Wed, 06 June 2018 09:36 Go to previous messageGo to next message
Davide Arcelli is currently offline Davide ArcelliFriend
Messages: 7
Registered: May 2018
Junior Member
Hi guys,

I am now facing the former problem I have pointed out in this topic, since I am trying to integrate the minimal example into my main project.
All the needed resources and dependencies have been copied within the main project, but I'm still getting the following error at the beginning of my etl file:
[epsilon.etl - <transformation name>.etl] Line: X, Column: Y Reason: mismatched input: ';'

Please notice that I am running 2 etl transformations via Java and I am getting the error above in both cases. Hence, you can assume that my etl files are well-formed (even because I already tested them in a standalone ad-hoc project). This should mean that the problem is related to some libraries; however, every library needed is included in the classpath/dependencies of the main project. Basically, it seems to me that it is trying to parse etl files with an incorrect epsilon parser. Note that I am not launching etl transformations through EtlModule, but through specific ant scripts invoking the epsilon.etl ant task (which has been properly defined as extension in the plugin.xml file).

Any suggestion? Please note that providing a minimal example for this problem would probably mean providing my main project, but this would be unpracticable. On the other hand, creating a minimal example for transformation invocation only would result in a project without problems (as I did before).
Re: Executing an ant build file programmatically which, in turn, executes an etl transformation [message #1790161 is a reply to message #1790158] Wed, 06 June 2018 10:39 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1612
Registered: July 2009
Location: York, UK
Senior Member

Hi Davide,

I can't really see how we can help unless we're able to reproduce the issue you're encountering locally.

> Please note that providing a minimal example for this problem would probably mean providing my main project, but this would be unpracticable

Is this due to the size of the code or due to confidentiality concerns?

Cheers,
Dimitris
Re: Executing an ant build file programmatically which, in turn, executes an etl transformation [message #1790181 is a reply to message #1790161] Wed, 06 June 2018 15:10 Go to previous messageGo to next message
Davide Arcelli is currently offline Davide ArcelliFriend
Messages: 7
Registered: May 2018
Junior Member
Hi Dimitris,

it is due to the size of the code. The main project is very large, as it contains several other functionalities.
I think my problem is in someway similar to this:

https://www.eclipse.org/forums/index.php/t/1070315/

However, I'm not running the etl transformation via Java, but via ant that uses epsilon ant tasks.
I would remark that, only the epsilon.etl ant task fails, whereas all the other epsilon ant tasks are
correctly executed.

In addition, please find attached:
- a screenshot of all the plugin dependencies of my main project.
- a screenshot of the java build path libraries of my main project.
- a screenshot of all the extensions defined by my main project, with emphasis on epsilon ant tasks.
Could it be that one of those imported jars overwrite the correct antlr?

Thank you for your help, best regards,
Davide
Re: Executing an ant build file programmatically which, in turn, executes an etl transformation [message #1790182 is a reply to message #1790181] Wed, 06 June 2018 15:16 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1612
Registered: July 2009
Location: York, UK
Senior Member

Hi Davide,

Yes, this could be the case.

Cheers,
Dimitris
Re: Executing an ant build file programmatically which, in turn, executes an etl transformation [message #1790230 is a reply to message #1790182] Thu, 07 June 2018 09:57 Go to previous messageGo to next message
Davide Arcelli is currently offline Davide ArcelliFriend
Messages: 7
Registered: May 2018
Junior Member
Hi guys,

I would let you know that I have solved my problem.
As supposed, some dependencies of my main project were using an old version of ant runtime, taking priority over the one I selected.
In particular, I had some dependencies to the 1.3.0 version of epsilon eol, evl, and common. I removed those dependencies and everything started to work properly :)

Thank you for your time and support.

Cheers,
Davide
Re: Executing an ant build file programmatically which, in turn, executes an etl transformation [message #1790242 is a reply to message #1790230] Thu, 07 June 2018 11:05 Go to previous message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 1612
Registered: July 2009
Location: York, UK
Senior Member

Hi Davide,

Excellent - thanks for sharing this!

Cheers,
Dimitris
Previous Topic:Roadmap epsilon
Next Topic: Class Cast Exception
Goto Forum:
  


Current Time: Fri Nov 16 20:29:07 GMT 2018

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

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

Back to the top