|
|
|
Re: True standalone maven/gradle capability in 2.9? [message #1713491 is a reply to message #1713399] |
Wed, 04 November 2015 15:12 |
Scott Long 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 #1713519 is a reply to message #1713516] |
Wed, 04 November 2015 18:23 |
|
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 |
|
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
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06053 seconds