Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Passing config from maven to xtext generator
Passing config from maven to xtext generator [message #1376581] Fri, 23 May 2014 09:32 Go to next message
Eclipse UserFriend
Hi,

we are using the same DSL and generators in different projects. The generators are integrated in the maven build by the xtext-maven-plugin.
Is it possible to pass a configuration from a maven build to the generators?

thanks & regards
Norman
Re: Passing config from maven to xtext generator [message #1376636 is a reply to message #1376581] Fri, 23 May 2014 10:00 Go to previous messageGo to next message
Eclipse UserFriend
Hi can you be a bit more specific about "coniguration"
Re: Passing config from maven to xtext generator [message #1376646 is a reply to message #1376581] Fri, 23 May 2014 10:08 Go to previous messageGo to next message
Eclipse UserFriend
I had a look at the code. I did not See anything in that so Plesse
file an enhancement in that.

If you tell US about your usecase it might be possible to find a
workaround
Re: Passing config from maven to xtext generator [message #1376697 is a reply to message #1376646] Fri, 23 May 2014 10:37 Go to previous messageGo to next message
Eclipse UserFriend
Our usecase is to define property in the pom. The property is passed to the generator and the generator uses the value of the property as a prefix for the generated files.
Re: Passing config from maven to xtext generator [message #1376706 is a reply to message #1376697] Fri, 23 May 2014 10:43 Go to previous messageGo to next message
Eclipse UserFriend
Hi

Why don't you put this information into the model? Alternatively you
could try to use system properties or write your own (subtype) of the
mojo
Re: Passing config from maven to xtext generator [message #1376751 is a reply to message #1376706] Fri, 23 May 2014 11:09 Go to previous message
Eclipse UserFriend
Hi Norman,

you can use a composite workflow:

CompositeWorkflow.mwe2
module my.composite.workflow

import org.eclipse.emf.mwe.utils.*

Workflow {

   component = @my.single.workflow auto-inject {
	prefix = "customPrefix"
   }
}


CompositeWorkflow.mwe2
CompositeWorkflow.mwe2
module my.composite.workflow

import org.eclipse.emf.mwe.utils.*

Workflow {
   var prefix = ""
   var name = "${prefix}Name"
}


And via properties you can control which mwe2 file to execute

<plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>exec-maven-plugin</artifactId>
   <version>${exec-maven-plugin-version}</version>
   <executions>
      <execution>
         <phase>generate-sources</phase>
         <goals>
            <goal>java</goal>
         </goals>
      </execution>
   </executions>
   <configuration>
      <skip>${skip.mwe2}</skip>
      <includeProjectDependencies>false</includeProjectDependencies>
      <includePluginDependencies>true</includePluginDependencies>
      <mainClass>org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher</mainClass>
      <arguments>
         <argument>file://${project.basedir}/${mwe2.relative.path}</argument>
      </arguments>
   </configuration>
   <dependencies>
      <dependency>
         <groupId>org.eclipse.xtext</groupId>
         <artifactId>org.eclipse.xtext.xtext</artifactId>
         <version>${xtext-version}</version>
      </dependency>
      <dependency>
         <groupId>org.eclipse.xtext</groupId>
         <artifactId>org.eclipse.xtext.xbase</artifactId>
         <version>${xtext-version}</version>
      </dependency>
   </dependencies>
</plugin>


Joerg
Previous Topic:Set values to an object by changing references.
Next Topic:[SOLVED] Validation errors when trying to launch Eclipse Application
Goto Forum:
  


Current Time: Wed Jul 23 11:01:25 EDT 2025

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

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

Back to the top