Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [mwe2] unmapped paths platform:/resource/
[mwe2] unmapped paths platform:/resource/ [message #1735121] Wed, 15 June 2016 16:22 Go to next message
Bruce L. is currently offline Bruce L.Friend
Messages: 81
Registered: June 2011
Member
Hi,

I am running a MWE2 workflow from the command line, outside eclipse (using an ant file which lunches org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher)

I have a problem with URIs in the form of "platform:/resource/..."

For example, in my worflow, I have

...
      language = StandardLanguage {
            referencedResource = "platform:/resource/..../xyz.genmodel"
...


because the grammar of my DSL references the grammar of another one.

When running the workflow, I get this error:
...
java.io.IOException: The path '/..../xyz.genmodel' is unmapped
...


Note that "platform:/resource" has been stripped.

I know that the problem is not limited to the case of "referencedResource" but appears every other time there is some reference to URIs in the form "platform:/resource".

I am using the jars of Xtext 2.9.

In older versions, the MWE2 file was different and the StandaloneSetup used to have the attribute platformUri, which I could set. Now I can't.
I'm not sure how "platform:/resource" gets resolved or why it gets stripped in the exception message.

Thanks for any suggestion
Re: [mwe2] unmapped paths platform:/resource/ [message #1735123 is a reply to message #1735121] Wed, 15 June 2016 16:50 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14652
Registered: July 2009
Senior Member
actually the /..../ part is the most interesting one.

where does it point to?

is the classpath correct. does it contain the /..../ thing?



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [mwe2] unmapped paths platform:/resource/ [message #1735129 is a reply to message #1735123] Wed, 15 June 2016 17:36 Go to previous messageGo to next message
Bruce L. is currently offline Bruce L.Friend
Messages: 81
Registered: June 2011
Member
let's say that my URI is

Quote:

platform:/resource/referencedProj/model/generated/xyz.genmodel


and the actual file is in this directory:

Quote:

{root}/referencedProj/model/generated/xyz.genmodel


And root *is* in the classpath
Re: [mwe2] unmapped paths platform:/resource/ [message #1735132 is a reply to message #1735129] Wed, 15 June 2016 17:40 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14652
Registered: July 2009
Senior Member
I don't get the root is the classpath thing. How does that look like in ant?
You may give a try debugging standalone setup .setscanclasspath


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [mwe2] unmapped paths platform:/resource/ [message #1735136 is a reply to message #1735132] Wed, 15 June 2016 18:08 Go to previous messageGo to next message
Bruce L. is currently offline Bruce L.Friend
Messages: 81
Registered: June 2011
Member
The classpath variable in ant contains, among various other things, also the path of the folder {root}.

I have not standalone setup, it's a recent workflow file. The component is XtextGenerator and the relevant attribute is language:

Workflow {
	component = XtextGenerator {
		configuration = {
			project = StandardProjectConfig {
				baseName = "myProject"
				rootPath = rootPath // this is btw the same as my folder {root}
	                        ....
			}
		}
		language = StandardLanguage {
                      ...
			referencedResource = "platform:/resource/referencedProj/model/generated/xyz.genmodel"
		   ...
		}
	}
}


And my folders on the file system:

{root}/myProject/ ...
{root}/referencedProj/ ...


(these are actually the folders where the xtext-generated artifacts are placed, and model/generated/xyz.genmodel is one of those)

I hope it's understandable.
Thank you for your help.
Re: [mwe2] unmapped paths platform:/resource/ [message #1735137 is a reply to message #1735136] Wed, 15 June 2016 18:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14652
Registered: July 2009
Senior Member
Xtext will magically call the standalone setup class.

This will have a look at class classpath and will look for jars .project files etc.

Unfortunately I don't have the time to build a hello world example reproducing your problem

Usually (maven grade) you put the result jar of the first project to the classpath of the workflow of the second project


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [mwe2] unmapped paths platform:/resource/ [message #1735235 is a reply to message #1735137] Thu, 16 June 2016 13:47 Go to previous messageGo to next message
Bruce L. is currently offline Bruce L.Friend
Messages: 81
Registered: June 2011
Member
Could it not be a problem related to resolving 'platform:/resource' instead of the classpath?

When I run the workflow file within Eclipse, and I put a deliberately wrong relative path for the .genmodel file, I get a file not found exception, and I see that the 'platform:/resource' has been resolved with the actual, absolute path of the Eclipse workspace on my filesystem (so, it makes sense)

This does not happen when I run the workflow outside eclipse; it seems that 'platform:/resource' is not mapped to anything.

Thanks
Re: [mwe2] unmapped paths platform:/resource/ [message #1735239 is a reply to message #1735235] Thu, 16 June 2016 14:26 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14652
Registered: July 2009
Senior Member
as i said.

xtext generator will call standalonesetup (at org.eclipse.xtext.xtext.generator.XtextGeneratorStandaloneSetup.setup()) which will build up the mapping of the stuff on the classpath to platform:/resource/xxx uris.
therefore it will have a look at the classpath elements and look for jar files and for .project files.

in eclipse with will work cause the classpath is right. so what about debugging org.eclipse.emf.mwe.utils.StandaloneSetup.doRegisterResourceMapping(File) inside eclipse


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [mwe2] unmapped paths platform:/resource/ [message #1735600 is a reply to message #1735239] Tue, 21 June 2016 11:39 Go to previous messageGo to next message
Bruce L. is currently offline Bruce L.Friend
Messages: 81
Registered: June 2011
Member
Hi, thanks.

Sorry debugging did not help so far.

I understand that within Eclipse it works as the classpath is right. In fact, it's enough to add 'referencedProj' in properties -> java-build-path -> projects for 'myProject' and Eclipse magically sets the classpath.

How to reproduce the same in the ant file where I invoke the mwe2 runner?
Currently, I have something like this:

<path id="classpath">
    <fileset dir="<root where my xtext jars are>" includes="**/*.jar" />
    <!-- none of the following does the trick -->
    <pathelement path="${basedir}/referencedProj/"/>
    <pathelement path="${basedir}/referencedProj/model/generated"/>
    <pathelement path="referencedProj"/>
</path>

    <target name="generate-xtext-artifacts">
        <java classpathref="classpath"
              classname="org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher"
              failonerror="true">
            <sysproperty key="log4j.configuration" value="${log4j_cfg}"/>
            <arg value="......./GenerateDSL.mwe2"/>
        </java>
    </target>


Do you see any obvious mistake in my classpath? That works fine when the project is not referencing another one.

Thanks anyway.
Re: [mwe2] unmapped paths platform:/resource/ [message #1735607 is a reply to message #1735600] Tue, 21 June 2016 12:16 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14652
Registered: July 2009
Senior Member
Can you create s small example I can simply run

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [mwe2] unmapped paths platform:/resource/ [message #1735614 is a reply to message #1735607] Tue, 21 June 2016 12:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14652
Registered: July 2009
Senior Member
i actually found your problem.

 <java classpathref="classpath"
	              classname="org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher"
	              failonerror="true" fork="true">



you missed the

fork="true"


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: [mwe2] unmapped paths platform:/resource/ [message #1735623 is a reply to message #1735614] Tue, 21 June 2016 13:06 Go to previous messageGo to next message
Bruce L. is currently offline Bruce L.Friend
Messages: 81
Registered: June 2011
Member
Great!!!!
That worked!!!!

I would have never realized that myself, thanks a lot.

From ant documentation of the java task:
fork    	if enabled triggers the class execution in another VM (disabled by default)


I wonder why it solved my classpath problem...

Thanks again.
Re: [mwe2] unmapped paths platform:/resource/ [message #1735628 is a reply to message #1735623] Tue, 21 June 2016 13:30 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14652
Registered: July 2009
Senior Member
i dont know what the ant java task invoken when non forked.

String property = System.getProperty("java.class.path")


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:xtext not showing latest dependencies for org.eclipse.emf.ecore.xcore
Next Topic:Transforming Xtext DSL to XMI
Goto Forum:
  


Current Time: Sun Feb 25 16:28:34 GMT 2024

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