Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » True standalone maven/gradle capability in 2.9?(Will 2.9 general release (autumn 2015) include true eclipse-free capability)
True standalone maven/gradle capability in 2.9? [message #1713374] Tue, 03 November 2015 16:09 Go to next message
Scott Long is currently offline Scott LongFriend
Messages: 4
Registered: November 2015
Junior Member
Hi -- I am very interested in this mention in news (https://eclipse.org/Xtext/news.html) on a possible 2.9 capability:

Quote:
One goal for instance is to allow for xtext projects without any Eclipse dependency, such that you can just use the runtime and build and deploy it with Maven or Gradle.


I have seen many descriptions of engineers attempting to extract this into a standalone capability themselves using various approaches, but I would much prefer to wait for 2.9 if it is a core capability so it is easier to stay up to date with xtext releases.

Will a true maven-enabled, totally eclipse-free run mode be an integral part of 2.9? I don't see it in the 2.9 beta yet. Goal is a DSL project where the only file that is checked into our source control is the .xtext grammar file and the generator/*.xtend file(s). Taking these two or three files and running mvn or gradle (via Jenkins) would execute xtext, generate all src-gen and xtend-gen files, compile and build an executable jar. The executable jar would be the finished product, able to compile end-user DSL files.

thanks!
Re: True standalone maven/gradle capability in 2.9? [message #1713397 is a reply to message #1713374] Tue, 03 November 2015 18:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
There is no" create the executable" yet and will probably not be. The rest is there already. And there is a maven and gradle module that allows you to call your langs generator.

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: True standalone maven/gradle capability in 2.9? [message #1713399 is a reply to message #1713397] Tue, 03 November 2015 18:46 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
P.s so what you are missing is a "build me an uber jar with you lang and all deps thing" ?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: True standalone maven/gradle capability in 2.9? [message #1713491 is a reply to message #1713399] Wed, 04 November 2015 15:12 Go to previous messageGo to next message
Scott Long is currently offline Scott LongFriend
Messages: 4
Registered: November 2015
Junior Member
Thanks -- yes i think that's a good description of what i'm looking for. Restating another way to be sure i am communicating it well. Maybe there is a way to do this -- if there is, i'd appreciate direction -

Basically i want to be able to do the equivalent of this, but via command-line/mvn:

(1) right-click on the mwe2 workflow under src then Run As --> MWE2 Workflow
(2) then right click on my .xtext grammar under src and Run As --> Generate XText Artifacts,
(3) then right click on the project --> Export --> executable jar file.

That executable .jar file is what i'd like to be able to regenerate anytime i edit my .xtext grammar file, and i'd like to generate it from mvn (and via jenkins) -- git clone, then mvn jar

Is there a straightforward way to do this in 2.9? Suggestions much appreciated.

[Updated on: Wed, 04 November 2015 15:14]

Report message to a moderator

Re: True standalone maven/gradle capability in 2.9? [message #1713494 is a reply to message #1713491] Wed, 04 November 2015 15:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
Yes and no. You still have to use non xtext stuff for 3
But (at least maven) has stuff for that.
And youhave tocreate a java main manually


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: True standalone maven/gradle capability in 2.9? [message #1713511 is a reply to message #1713494] Wed, 04 November 2015 17:18 Go to previous messageGo to next message
Scott Long is currently offline Scott LongFriend
Messages: 4
Registered: November 2015
Junior Member
ok thanks -- so what is a good place to start for (1) and (2) ?

One thing i see is maven-xtext-example, but it does not have a generator/ dir. Is that the best place to start though?

Re: True standalone maven/gradle capability in 2.9? [message #1713516 is a reply to message #1713511] Wed, 04 November 2015 17:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
Simply use the new project wizard in the beta.(6)
It will generate poms or gradle build files for you
You can tune the workflow to create a java main

Please note the uber jar part may be tricky since jar in jar is not allowed and there might be non unique but required resouced.

Thus the question. Why not using a pom in the model files project?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: True standalone maven/gradle capability in 2.9? [message #1713519 is a reply to message #1713516] Wed, 04 November 2015 18:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
i just gave it a try

(1) create new next project using the wizard
(2) on the second page
(a) deselect all projects
(b) built type and layout maven
(3) edit the workflow and add the following to the langage config

generator = {
generateJavaMain = true
}

(4) edit the pom.xml in the mydsl project

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.5</version>
<configuration>
<descriptors>
<descriptor>jar-with-ecore-model.xml</descriptor>
</descriptors>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
<archive>
<manifest>
<mainClass>org.xtext.example.mydsl.generator.Main</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>

(5) go to the parent dir and mvn clean install
(6) in the target of the child mydsl project is a jar you can call with java -jar abc.jar test.mydsl
(ignore the message - this is through the resources hickup mentioned before)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: True standalone maven/gradle capability in 2.9? [message #1713523 is a reply to message #1713519] Wed, 04 November 2015 18:42 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
and for the pom option

(1)+(2)
as above
(of cource you should implement the igenerator as well)

in parent create a new child module named org.xtext.example.mydsl.model
with the following pom

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.xtext.example.mydsl</groupId>
<artifactId>org.xtext.example.mydsl.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>org.xtext.example.mydsl.model</artifactId>
<packaging>jar</packaging>

<build>
<plugins>
<plugin>
<groupId>org.eclipse.xtext</groupId>
<artifactId>xtext-maven-plugin</artifactId>
<version>${xtextVersion}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<languages>
<!-- Add additional standalone setups if you have more than one language -->
<language>
<setup>org.xtext.example.mydsl.MyDslStandaloneSetup</setup>
<outputConfigurations>
<outputConfiguration>
<outputDirectory>src/main/generated-sources/xtext/</outputDirectory>
</outputConfiguration>
</outputConfigurations>
</language>
</languages>
</configuration>
<dependencies>
<!-- add a dependency to the language core bundle, this will only be needed during geneeration and will not pollute your project's classpath. -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>org.xtext.example.mydsl</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>

add the module to the parent pom

<modules>
<module>org.xtext.example.mydsl</module>
<module>org.xtext.example.mydsl.model</module>
</modules>

place model files in *.model/src/main/java


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
icon14.gif  Re: True standalone maven/gradle capability in 2.9? [message #1713777 is a reply to message #1713519] Fri, 06 November 2015 15:36 Go to previous messageGo to next message
Scott Long is currently offline Scott LongFriend
Messages: 4
Registered: November 2015
Junior Member
Thank you very much Christian.

Using your instructions I've been successful in creating a maven project that will create an executable jar file. This executable jar file will turn user-written DSL that complies with our .xtext grammar into Java code that implements the user-written intent. Thanks again!

(now we are looking for a maven project that can be used to create the eclipse plugin for the .xtext grammar -- is that capability in 2.9? being able to turn the .xtext file into an eclipse plugin without using eclipse to generate the plugin?)
Re: True standalone maven/gradle capability in 2.9? [message #1713778 is a reply to message #1713777] Fri, 06 November 2015 15:42 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14716
Registered: July 2009
Senior Member
You an have a look at maven tycho. (Wizard has support for that afaik) or the maven bundle plugin

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Serialisation time grows exponentially when adding new elements to model instance
Next Topic:ANTLR and Xtext integration for developing plugin
Goto Forum:
  


Current Time: Tue Sep 24 09:20:31 GMT 2024

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

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

Back to the top