kutschkem
kutschkem

Reputation: 8163

How to configure source compatbility level for xtend-maven-plugin?

Follow-up of Is there a P2 repository with an up-to-date javassist?

The issue I have is related to Java lambdas. I am also using xtend, and xtend lambdas are generated as Java lambdas if source level compatibility is set to Java 8+, but as anonymous classes.

I know how to set the source compatibility level in Eclipse, but how do I configure it for xtend-maven-plugin? I did not find documentation.

Upvotes: 1

Views: 539

Answers (2)

Lutz Wrage
Lutz Wrage

Reputation: 46

This is with xtend 2.20.

The 2.14.0 answer did not work for me. I had to use

<configuration>
    <javaSourceVersion>1.8</javaSourceVersion>
</configuration>

in my pom file to force the xtend maven plugin to produce Java 8 code instead of the default, which is Java 1.6.

Upvotes: 2

kutschkem
kutschkem

Reputation: 8163

How to set source level compatibility for xtend-maven-plugin 2.14.0

The property for this is maven.compiler.source.

    <plugin>
        <groupId>org.eclipse.xtend</groupId>
        <artifactId>xtend-maven-plugin</artifactId>
        <version>2.14.0</version>
        <configuration>
            <maven.compiler.source>1.7</maven.compiler.source>
        </configuration>
    </plugin>

How I found this information

Maybe this can help someone in the future: Since this plugin has next to no documentation, I went to the Mojo source code and found:

/**
 * Create Java Source Code that is compatible to this Java version.
 * 
 * Supported values: 1.5, 1.6, 1.7, 1.8, 9 and 10
 */
@Parameter(property="maven.compiler.source", defaultValue="1.6")
private String javaSourceVersion;

Upvotes: 1

Related Questions