davidB / scala-maven-plugin

The scala-maven-plugin (previously maven-scala-plugin) is used for compiling/testing/running/documenting scala code in maven.
https://davidb.github.io/scala-maven-plugin/
The Unlicense
557 stars 151 forks source link

Zinc is invoked with two -release arguments #679

Closed andreak closed 1 year ago

andreak commented 1 year ago

Hi, I'm trying to target JDK-16 and I'm running with this plugin-config:

<version.scalalibs>2.12.17</version.scalalibs> <version.scala-maven-plugin>4.8.1</version.scala-maven-plugin>

<plugin>
    <groupId>net.alchim31.maven</groupId>
    <artifactId>scala-maven-plugin</artifactId>
    <version>${version.scala-maven-plugin}</version>
    <configuration>
        <args>
            <arg>-release</arg>
            <arg>${build.jdk.version}</arg>
        </args>
        <scalaVersion>${version.scalalibs}</scalaVersion>
    </configuration>
</plugin>

And this plugin goal:

<plugin>
    <groupId>net.alchim31.maven</groupId>
    <artifactId>scala-maven-plugin</artifactId>
    <version>${version.scala-maven-plugin}</version>
    <executions>
        <execution>
            <goals>
                <goal>add-source</goal>
                <goal>compile</goal>
                <goal>testCompile</goal>
            </goals>
        </execution>
    </executions>
</plugin>

This results in the following two -release arguments:

[DEBUG] [zinc] The Scala compiler is invoked with:
        -release
        16
        -release
        8

This isn't an issue with version 4.7.1 of the plugin.

Any way around this?

slandelle commented 1 year ago

Remove this custom -release argument and use the standard maven option maven.compiler.release.

andreak commented 1 year ago

Thanks, that works:-)