Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to configure xtend-maven-plugin to target earlier Java versions
How to configure xtend-maven-plugin to target earlier Java versions [message #1732246] Fri, 13 May 2016 19:53 Go to next message
Matthew Adams is currently offline Matthew AdamsFriend
Messages: 57
Registered: July 2009
Location: Austin, TX
Member

Hi all,

How do I configure xtend-maven-plugin to target the Java 1.6 language level and avoid including any classes present in JDK 1.7 & later, even if I'm currently building using the latest JDK 8?

So far, I've found https://bugs.eclipse.org/bugs/show_bug.cgi?id=461239, https://www.eclipse.org/xtend/documentation/201_types.html (4th paragraph under "Java Interoperability", and https://bugs.eclipse.org/bugs/show_bug.cgi?id=438764 (which includes a link to a review at https://git.eclipse.org/r/#/c/29797/ which is now gone).

I can't seem to find complete documentation on xtend-maven-plugin.

Thanks,
Matthew
Re: How to configure xtend-maven-plugin to target earlier Java versions [message #1732258 is a reply to message #1732246] Sat, 14 May 2016 06:30 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13201
Registered: July 2009
Senior Member
please comment or open a bug on the still missing doc.
ntl using the proposed toolchain approach should be done easy

<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>
	<groupId>demo</groupId>
	<artifactId>demo</artifactId>
	<version>0.0.1-SNAPSHOT</version>

	<properties>
		<xtend-version>2.9.2</xtend-version>
		<maven.compiler.source>1.7</maven.compiler.source>
		<maven.compiler.target>1.7</maven.compiler.target>
	</properties>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-toolchains-plugin</artifactId>
				<version>1.0</version>
				<executions>
					<execution>
						<phase>validate</phase>
						<goals>
							<goal>toolchain</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<toolchains>
					
						<jdk>
							<id>JavaSE-1.7</id>
							
						</jdk>
					</toolchains>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.eclipse.xtend</groupId>
				<artifactId>xtend-maven-plugin</artifactId>
				<version>${xtend-version}</version>
				<executions>
					<execution>
						<goals>
							<goal>compile</goal>
							<goal>testCompile</goal>
						</goals>
						<configuration>
							<outputDirectory>${project.build.directory}/xtend-gen/main</outputDirectory>
							<testOutputDirectory>${project.build.directory}/xtend-gen/test</testOutputDirectory>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

	<dependencies>
		<dependency>
			<groupId>org.eclipse.xtend</groupId>
			<artifactId>org.eclipse.xtend.lib</artifactId>
			<version>${xtend-version}</version>
		</dependency>
	</dependencies>
</project>


<?xml version="1.0" encoding="UTF8"?>
<toolchains>
  <!-- JDK toolchains -->
  <toolchain>
    <type>jdk</type>
    <provides>
      <version>1.8</version>
      <id>JavaSE-1.8</id>
      <vendor>sun</vendor>
    </provides>
    <configuration>
      <jdkHome>/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/</jdkHome>
    </configuration>
  </toolchain>
  <toolchain>
    <type>jdk</type>
    <provides>
      <id>JavaSE-1.7</id>
      <version>1.7</version>
      <vendor>sun</vendor>
    </provides>
    <configuration>
      <jdkHome>/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/</jdkHome>
    </configuration>
  </toolchain>
</toolchains>


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:how to get an xtext expression as a java string from an ecore object
Next Topic:How to write xtext grammar for if statement
Goto Forum:
  


Current Time: Tue Nov 19 02:17:12 GMT 2019

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

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

Back to the top