Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 13:32 Go to next message
Norman Lenzner is currently offline Norman LenznerFriend
Messages: 4
Registered: April 2014
Junior Member
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 14:00 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13322
Registered: July 2009
Senior Member
Hi can you be a bit more specific about "coniguration"

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Passing config from maven to xtext generator [message #1376646 is a reply to message #1376581] Fri, 23 May 2014 14:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13322
Registered: July 2009
Senior Member
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


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Passing config from maven to xtext generator [message #1376697 is a reply to message #1376646] Fri, 23 May 2014 14:37 Go to previous messageGo to next message
Norman Lenzner is currently offline Norman LenznerFriend
Messages: 4
Registered: April 2014
Junior Member
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 14:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13322
Registered: July 2009
Senior Member
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


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Passing config from maven to xtext generator [message #1376751 is a reply to message #1376706] Fri, 23 May 2014 15:09 Go to previous message
Joerg Reichert is currently offline Joerg ReichertFriend
Messages: 80
Registered: July 2009
Location: Leipzig
Member
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


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
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: Tue Jan 28 16:10:08 GMT 2020

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

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

Back to the top