Skip to main content



      Home
Home » Modeling » TMF (Xtext) » xtext maven to use java 8 features
xtext maven to use java 8 features [message #1807996] Thu, 13 June 2019 22:23 Go to next message
Eclipse UserFriend
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] Thu, 13 June 2019 23:44 Go to previous messageGo to next message
Eclipse UserFriend
Did you try to sublass, customize and bind generator config in yourdslruntimemodule
Re: xtext maven to use java 8 features [message #1808022 is a reply to message #1807997] Fri, 14 June 2019 02:53 Go to previous messageGo to next message
Eclipse UserFriend
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 03:12 Go to previous message
Eclipse UserFriend
no chance i fear. (unless you come up with a patch for that github issue)

[Updated on: Fri, 14 June 2019 03:13] by 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: Fri Apr 25 12:44:37 EDT 2025

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

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

Back to the top