Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Mwe2Launcher - Cannot create a resource with ANT
Mwe2Launcher - Cannot create a resource with ANT [message #1810116] Wed, 31 July 2019 17:06 Go to next message
Adrien DUBEDAT is currently offline Adrien DUBEDATFriend
Messages: 2
Registered: July 2019
Junior Member
Hello !
I'm working on bringing the creation of a jar application from Eclipse to ANT.
In Eclipse, we use MWE2 at some point to generate some files and that means I also need to bring that code generation in the build.xml file for ANT.

In my current build.xml file, here is what I have :

<path id="project-classpath">
	<fileset dir="C:\Program Files\Eclipse\eclipse_XText\plugins\" includes="**\*.jar" />
</path>

<property name="configurationDSLSrcDir" location="src/ca/cmcelectronics/iap7000/config"/>

<target name="MWE2Generation">
	<java classname="org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher" classpathref="project-classpath" fork="false">
	<arg value="${configurationDSLSrcDir}/GenerateConfigurationDSL.mwe2"/>
	</java>
</target>


When I run the ANT script, I'm getting the following errors :

MWE2Generation:
     [java] 0    ERROR Mwe2Launcher       - Cannot create a resource for 'c:\e500mc_int178\trunk\Platform\Tools\PlatformDevTools\ConfigurationFileGeneratorTool\Code\ConfigFile\ca.cmcelectronics.iap7000.config\src\ca\cmcelectronics\iap7000\config/GenerateConfigurationDSL.mwe2'; a registered resource factory is needed
     [java] java.lang.RuntimeException: Cannot create a resource for 'c:\e500mc_int178\trunk\Platform\Tools\PlatformDevTools\ConfigurationFileGeneratorTool\Code\ConfigFile\ca.cmcelectronics.iap7000.config\src\ca\cmcelectronics\iap7000\config/GenerateConfigurationDSL.mwe2'; a registered resource factory is needed
     [java]     at org.eclipse.xtext.resource.XtextResourceSet.getResource(XtextResourceSet.java:198)
     [java]     at org.eclipse.xtext.resource.SynchronizedXtextResourceSet.getResource(SynchronizedXtextResourceSet.java:26)
     [java]     at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:57)
     [java]     at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
     .
     .
     .


I've looked around on the Internet and tried multiple suggestions found here and there but I wasn't able to fin anything helpful until now ...

Can anyone help out ?

Thanks !
Re: Mwe2Launcher - Cannot create a resource with ANT [message #1810557 is a reply to message #1810116] Tue, 13 August 2019 13:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13124
Registered: July 2009
Senior Member
hi, i have this done with fork only. the following works for me (on mac) maybe the mix of / and \ on windows is a problem too

<project default="MWE2Generation">

<path id="project-classpath">
	<fileset dir="/Users/dietrich/Eclipse201906/Eclipse.app/Contents/Eclipse/plugins" includes="**\*.jar" />
</path>

<target name="MWE2Generation">
	<java classname="org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher" classpathref="project-classpath" fork="true">
		<arg value="src/org/xtext/example/mydsl1/GenerateMyDsl.mwe2"/>
		<arg value="-p"/>
		<arg value="roothPath=${basedir}"/>
	</java>
</target>
</project>


p.s: is there any specific reason to use ant and not maven or gradle


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Mwe2Launcher - Cannot create a resource with ANT [message #1810566 is a reply to message #1810557] Tue, 13 August 2019 14:30 Go to previous message
Adrien DUBEDAT is currently offline Adrien DUBEDATFriend
Messages: 2
Registered: July 2019
Junior Member
Thank you Christian, I have moved on something else for now, I'll let you know if I go back to that !
Previous Topic:Restricting scope to variables in the current file + keep a crossfile scope for another type
Next Topic:Content assist test with import
Goto Forum:
  


Current Time: Wed Sep 18 09:05:01 GMT 2019

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

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

Back to the top