Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » executable jar for xtext 2.9.x with maven(How can I deliver my XTEXT application to end user (on 2.9.x))
executable jar for xtext 2.9.x with maven [message #1723412] Mon, 15 February 2016 13:24 Go to next message
Alex Gor is currently offline Alex GorFriend
Messages: 157
Registered: November 2014
Location: Russia
Senior Member
Hello Colleagues

I try to find out how can deliver my XTEXT application to end user.

I created default HelloWorld DSL using eclipse IDE.
I use maven as build system and maven file layout. When I creating project I use only Generic IDE support option in New Project Wizard
I'm able to build parent project after build I have to jar files one for mydsl and one for mydsl.ide. Both of them does not contain Main-Class - properties.Both of them include artifacts related to mydsl implementation.
Also I understand I shall include a lot of dependencies to my jar file (for example eclipse bundles)
It is clear.
In 2.8 I've created eclipse product defintion and make export of this product, than I can deliver application for my end user.

How can I the same on 2.9 release with maven

I found example on
https://github.com/xtext/maven-xtext-example and article about continues integration on https://eclipse.org/Xtext/documentation/350_continuous_integration.html

But no documentation how delivering xtext application that build with maven on 2.9.x platform to end user. End user means persons who use DSL language in his work

Partially this question was discussed in topic
https://www.eclipse.org/forums/index.php/t/1074770/

But I could not find final answer for my questions

Thank you in advance
Alex

[Updated on: Mon, 15 February 2016 14:02]

Report message to a moderator

Re: executable jar for xtext 2.9.x with maven [message #1723428 is a reply to message #1723412] Mon, 15 February 2016 15:17 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14067
Registered: July 2009
Senior Member
there is nothing out of the box.

jar-with-ecore-model.xml
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" 
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">
	<id>jar-with-ecore-model</id>
	<formats>
		<format>jar</format>
	</formats>
	<includeBaseDirectory>false</includeBaseDirectory>
	<fileSets>
		<fileSet>
			<outputDirectory>/</outputDirectory>
			<directory>target/classes</directory>
		</fileSet>
		<fileSet>
			<outputDirectory>model/generated</outputDirectory>
			<directory>model/generated</directory>
		</fileSet>
	</fileSets>
	<dependencySets>
    <dependencySet>
      <outputDirectory>/</outputDirectory>
      <useProjectArtifact>true</useProjectArtifact>
      <unpack>true</unpack>
      <scope>runtime</scope>
    </dependencySet>
  </dependencySets>
</assembly>


pom.xml
<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.mydsl4</groupId>
		<artifactId>org.xtext.example.mydsl4.parent</artifactId>
		<version>1.0.0-SNAPSHOT</version>
	</parent>
	<artifactId>org.xtext.example.mydsl4</artifactId>
	<packaging>jar</packaging>

	<build>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>exec-maven-plugin</artifactId>
				<version>1.4.0</version>
				<executions>
					<execution>
						<id>mwe2Launcher</id>
						<phase>generate-sources</phase>
						<goals>
							<goal>java</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<mainClass>org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher</mainClass>
					<arguments>
						<argument>/${project.basedir}/src/main/java/org/xtext/example/mydsl4/GenerateMyDsl.mwe2</argument>
						<argument>-p</argument>
						<argument>rootPath=/${project.basedir}/..</argument>
					</arguments>
					<classpathScope>compile</classpathScope>
					<includePluginDependencies>true</includePluginDependencies>
					<cleanupDaemonThreads>false</cleanupDaemonThreads><!-- see https://bugs.eclipse.org/bugs/show_bug.cgi?id=475098#c3 -->
				</configuration>
				<dependencies>
					<dependency>
						<groupId>org.eclipse.emf</groupId>
						<artifactId>org.eclipse.emf.codegen</artifactId>
						<version>(2.10,2.12)</version>
					</dependency>
				</dependencies>
			</plugin>
			<plugin>
				<groupId>org.eclipse.xtend</groupId>
				<artifactId>xtend-maven-plugin</artifactId>
			</plugin>
	
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-clean-plugin</artifactId>
				<configuration>
					<filesets combine.children="append">
						<fileset>
							<directory>${basedir}/../org.xtext.example.mydsl4/src/main/xtext-gen/</directory>
							<includes>
								<include>**/*</include>
							</includes>
						</fileset>
						<fileset>
							<directory>${basedir}/model/generated/</directory>
						</fileset>
					</filesets>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<version>1.9.1</version>
				<executions>
					<execution>
						<id>add-source</id>
						<phase>initialize</phase>
						<goals>
							<goal>add-source</goal>
							<goal>add-resource</goal>
						</goals>
						<configuration>
							<sources>
								<source>src/main/xtext-gen</source>
							</sources>
							<resources>
								<resource>
									<directory>src/main/xtext-gen</directory>
									<excludes>
										<exclude>**/*.java</exclude>
										<exclude>**/*.g</exclude>
									</excludes>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-assembly-plugin</artifactId>
				<version>2.5.5</version>
				<configuration>
					<descriptors>
						<descriptor>jar-with-ecore-model.xml</descriptor>
					</descriptors>
					<archive>
            <manifest>
              <mainClass>org.xtext.example.mydsl4.generator.Main</mainClass>
            </manifest>
          </archive>
					<appendAssemblyId>false</appendAssemblyId>
				</configuration>
				<executions>
					<execution>
						<id>make-assembly</id>
						<phase>package</phase>
						<goals>
							<goal>single</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.eclipse.m2e</groupId>
					<artifactId>lifecycle-mapping</artifactId>
					<version>1.0.0</version>
					<configuration>
						<lifecycleMappingMetadata>
							<pluginExecutions>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>
											org.codehaus.mojo
										</groupId>
										<artifactId>
											exec-maven-plugin
										</artifactId>
										<versionRange>
											[1.2.1,)
										</versionRange>
										<goals>
											<goal>java</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore></ignore>
									</action>
								</pluginExecution>
							</pluginExecutions>
						</lifecycleMappingMetadata>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>

	<dependencies>
		<dependency>
			<groupId>org.eclipse.xtext</groupId>
			<artifactId>org.eclipse.xtext</artifactId>
			<version>${xtextVersion}</version>
		</dependency>
		<dependency>
			<groupId>org.eclipse.xtext</groupId>
			<artifactId>org.eclipse.xtext.xbase</artifactId>
			<version>${xtextVersion}</version>
		</dependency>
		<dependency>
			<groupId>org.eclipse.xtext</groupId>
			<artifactId>org.eclipse.xtext.xtext</artifactId>
			<version>${xtextVersion}</version>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.eclipse.xtext</groupId>
			<artifactId>org.eclipse.xtext.xtext.generator</artifactId>
			<version>${xtextVersion}</version>
			<optional>true</optional>
		</dependency>
	</dependencies>
</project>



there will be an exception java.util.MissingResourceException: The string resource '_UI_DiagnosticRoot_diagnostic' could not be located
cause of multuiples properties shading each other. that my be solved by creating a uber plugin.properties manually (or simply be ignore)

or you do not pack the dependencies into the jar but manage the classpath yourself e.g. using the maven dependencies plugin


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Mon, 15 February 2016 15:21]

Report message to a moderator

Previous Topic:Xtext 2.9 maven + generate artifacts
Next Topic:Xtend Specific Issue
Goto Forum:
  


Current Time: Mon Sep 27 11:18:17 GMT 2021

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

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

Back to the top