Open
Description
Here is the simplest reproducible example: https://github.com/LuciferYang/scala-maven-plugin-test
The reproducible code is very simple:
package personal.code
import sun.util.calendar.ZoneInfo
import java.util.TimeZone
object TestUtils {
def doTest(): Boolean = TimeZone.getDefault.isInstanceOf[ZoneInfo]
}
run
git clone git@github.com:LuciferYang/scala-maven-plugin-test.git
cd scala-maven-plugin-test
mvn clean install -X // Use versions higher than Java 11, such as use Java 17 to run maven clean install
We can see the following compilation error:
[DEBUG] [zinc] The Scala compiler is invoked with:
-unchecked
-deprecation
-feature
-explaintypes
-target:11
-release
11
-bootclasspath
/Users/yangjie01/.m2/repository/org/scala-lang/scala-library/2.13.11/scala-library-2.13.11.jar
-classpath
/Users/yangjie01/SourceCode/git/scala-maven-plugin-test/target/classes:/Users/yangjie01/.m2/repository/org/scala-lang/scala-reflect/2.13.11/scala-reflect-2.13.11.jar:/Users/yangjie01/.m2/repository/org/scala-lang/scala-compiler/2.13.11/scala-compiler-2.13.11.jar:/Users/yangjie01/.m2/repository/io/github/java-diff-utils/java-diff-utils/4.12/java-diff-utils-4.12.jar:/Users/yangjie01/.m2/repository/org/jline/jline/3.22.0/jline-3.22.0.jar:/Users/yangjie01/.m2/repository/net/java/dev/jna/jna/5.13.0/jna-5.13.0.jar:/Users/yangjie01/.m2/repository/org/scala-lang/scala-library/2.13.11/scala-library-2.13.11.jar
[WARNING] [Warn] : -target is deprecated: Use -release instead to compile against the correct platform API.
[ERROR] [Error] /Users/yangjie01/SourceCode/git/scala-maven-plugin-test/src/main/scala/personal/code/TestUtils.scala:3: object util is not a member of package sun
[ERROR] [Error] /Users/yangjie01/SourceCode/git/scala-maven-plugin-test/src/main/scala/personal/code/TestUtils.scala:8: not found: type ZoneInfo
[WARNING] one warning found
[ERROR] two errors found
[DEBUG] Compilation failed (CompilerInterface)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.368 s
[INFO] Finished at: 2023-09-12T19:53:26+08:00
[INFO] ------------------------------------------------------------------------
mvn clean install -Dscala-maven-plugin.version=4.8.0
and mvn clean install -Dscala-maven-plugin.version=4.7.2
will have the same error.
mvn clean install -Dscala-maven-plugin.version=4.7.1
will build success
The -release
option is automatically appended after #648.
Maybe we need to add an new option that doesn’t enforce appending -release
when it’s false?
Metadata
Metadata
Assignees
Labels
No labels