Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » xtext maven to use java 8 features
xtext maven to use java 8 features [message #1807996] Fri, 14 June 2019 02:23 Go to next message
paul lu is currently offline paul luFriend
Messages: 43
Registered: April 2013
Member
Hi,

I want some elements in my DSL (xbase based) to compile to java 8 default interface methods. Works in eclipse. But it doesn't work with maven.

Setting maven.compiler.source to 1.8 does not set version on
org.eclipse.xtext.xbase.compiler.GeneratorConfig
which is used in xbase compiler to determine whether to generate java 8 sources.

Also I find this issue:
https://github.com/eclipse/xtext-maven/issues/11

Is there any workaround now to compile DSL to java 8 sources in maven build ?

Thanks.
Re: xtext maven to use java 8 features [message #1807997 is a reply to message #1807996] Fri, 14 June 2019 03:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13163
Registered: July 2009
Senior Member
Did you try to sublass, customize and bind generator config in yourdslruntimemodule

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: xtext maven to use java 8 features [message #1808022 is a reply to message #1807997] Fri, 14 June 2019 06:53 Go to previous messageGo to next message
paul lu is currently offline paul luFriend
Messages: 43
Registered: April 2013
Member
Thanks, I was able to bind a IGeneratorConfig in my runtime module.
But still I'd like to make the source level configurable, preferably use the same source level as the maven property : maven.compiler.source.

It seems there are two separate guice modules in the maven build: MavenStandaloneBuilderModule and my language Module.
The maven property maven.compiler.source is passed to the IJavaCompiler configured in MavenStandaloneBuilderModule.
see https://github.com/eclipse/xtext-maven/blob/master/org.eclipse.xtext.maven.plugin/src/main/java/org/eclipse/xtext/maven/XtextGenerator.java#L192
So it seems impossible to get the maven.compiler.source value in objects maintained by my language Module.

Maybe I need to rely on other approaches such as environment variable or reading external pom files to achieve this.
Re: xtext maven to use java 8 features [message #1808025 is a reply to message #1808022] Fri, 14 June 2019 07:12 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13163
Registered: July 2009
Senior Member
no chance i fear. (unless you come up with a patch for that github issue)

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

[Updated on: Fri, 14 June 2019 07:13]

Report message to a moderator

Previous Topic:After Xtext 2.18.0 migration, SWT Bot is not installing
Next Topic:How to install a JavaScript editor for Eclipse?
Goto Forum:
  


Current Time: Mon Oct 21 04:56:30 GMT 2019

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

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

Back to the top