Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » rootPath, alternative folder layouts and maven build
rootPath, alternative folder layouts and maven build [message #1740069] Mon, 08 August 2016 21:59 Go to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member

I have a language created with Xtext 2.10 where the Xtext-generated plugin folders are all contained in a folder which is not directly under the workspace. More precisely, I have a git repository where the language, called "xtumlrt.common", is under "plugins/xtumlrt/xtext/common" from the root of the repository. This folder contains all the plugins generated by Xtext.

The workflow works fine when I run it from my Eclipse workspace. The problem is that when I build with maven, the execution of the workflow fails with "The project's path '../org.eclipse.papyrusrt.xtumlrt.xtext.common' does not exist" (the full exception is at the end), in spite of the fact that
"plugins/xtumlrt/xtext/common/org.eclipse.papyrusrt.xtumlrt.xtext.common" does exist.

It looks like the problem is when the workflow calls StandardProjectConfig.addProjectMapping, and it seems to be using the rootPath, which is "..", the default given by Xtext.

My question is, is the problem indeed the rootPath or something else? Is the ".." setting for rootPath assuming that the workflow is executed from the folder of the plugin containing the workflow? And what exactly is the rootPath supposed to be? The path to the folder containing all the generated plugins, or the path to the root of the workspace, or something else?

Any suggestions on how to make it work on both the workspace and a maven build?


The full exception is this:

155  [org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main()] ERROR mf.mwe2.launch.runtime.Mwe2Launcher  - Problems running workflow org.eclipse.papyrusrt.xtumlrt.xtext.common.GenerateXTUMLRT: The project's path '../org.eclipse.papyrusrt.xtumlrt.xtext.common' does not exist
java.lang.RuntimeException: Problems running workflow org.eclipse.papyrusrt.xtumlrt.xtext.common.GenerateXTUMLRT: The project's path '../org.eclipse.papyrusrt.xtumlrt.xtext.common' does not exist
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at org.codehaus.mojo.exec.ExecJavaMojo$
Caused by: org.eclipse.emf.mwe.core.ConfigurationException: The project's path '../org.eclipse.papyrusrt.xtumlrt.xtext.common' does not exist
	at org.eclipse.emf.mwe.utils.StandaloneSetup.addProjectMapping(
	at org.eclipse.xtext.xtext.generator.XtextGeneratorStandaloneSetup$1.apply(
	at org.eclipse.xtext.xtext.generator.XtextGeneratorStandaloneSetup$1.apply(
	at org.eclipse.xtext.xbase.lib.IteratorExtensions.forEach(
	at org.eclipse.xtext.xbase.lib.IterableExtensions.forEach(
	at org.eclipse.xtext.xtext.generator.XtextGeneratorStandaloneSetup.setup(
	at org.eclipse.xtext.xtext.generator.XtextGeneratorStandaloneSetup.initialize(
	at org.eclipse.xtext.xtext.generator.XtextGenerator.initialize(
	at org.eclipse.xtext.xtext.generator.XtextGenerator.checkConfigurationInternal(
	at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent2.checkConfiguration(
	at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.preInvoke(
	at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.preInvoke(
	at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.preInvoke(

[SOLVED] Re: rootPath, alternative folder layouts and maven build [message #1740152 is a reply to message #1740069] Tue, 09 August 2016 19:45 Go to previous message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 438
Registered: March 2011
Senior Member
So the rootPath is indeed the path to the folder that contains all the generated xtext projects.

To summarize the problem I had, running the GenerateMyLanguage.mwe2 workflow worked when running it within the Eclipse workspace, but failed when running it from a hudson-triggered maven build, complaining that it couldn't find the path "../my.language.runtime.plugin".

The problem is that the value of rootPath is relative, and therefore dependent on the working directory used when running the workflow, and this working directory is not necessarily the same when running in Eclipse using the default launch configuration, and when running a Maven build.

The trick to make it work both within the Eclipse workspace and a separate Maven build is to do two things:

In the workflow, define a "workspace" property with a default value that points to the local path, and redefine "rootPath" to use this property:

module org.eclipse.papyrusrt.xtumlrt.xtext.common.GenerateXtextXtumlrt

import org.eclipse.xtext.xtext.generator.*
import org.eclipse.xtext.xtext.generator.model.project.*

var workspace = "../../../../.."
var rootPath = "${workspace}/plugins/xtumlrt/xtext/common"

Workflow {

In my case, I set workspace to "../../../../.." because the working directory is the location of my xtext generated runtime plugin project "org.eclipse.papyrusrt.xtumlrt.xtext.common" which is located at "plugins/xtumlrt/xtext/common" in my git repository.

This works in an Eclipse workspace because when you run the workflow, a default launch configuration is created which uses the path of the xtext generated runtime plugin (in my case 'org.eclipse.papyrusrt.xtumlrt.xtext.common') as the working directory.

The second thing is to ensure that the POM file which calls the Mwe2Launcher passes an extra "-p workspace=<build-path>" to the launcher. For example, in my case, I run the maven build from a Hudson instance, which executes from some working directory (defined by Hudson), and the workspace is created by a Hudson instance as "./source" (where "." is the Hudson working directory). So one needs to configure the "exec-maven-plugin" that calls the launcher as follows:


In this case, the lines


pass the value of "workspace" to the launcher, which then results in assigning "./source/plugins/xtumlrt/xtext/common" to rootPath, and the rest can be correctly resolved.
Previous Topic:How to set system environment variable eclipse configuration file?
Next Topic:How to specify a super class in JvmInferrer
Goto Forum:

Current Time: Sun Apr 14 22:46:22 GMT 2024

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

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

Back to the top