Maven + Spark(scala) – error:[ERROR] scalac error: bad option: ‘-make:transitive’
该错误发生在通过Maven打包Java scala classes的时候,具体报错如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
"C:\Program Files\Java\jdk-9.0.4\bin\java.exe" -Dmaven.multiModuleProjectDirectory=C:\Users\adamhuan\IdeaProjects\SparkMe "-Dmaven.home=C:\Program Files\JetBrains\IntelliJ IDEA 2018.1.3\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files\JetBrains\IntelliJ IDEA 2018.1.3\plugins\maven\lib\maven3\bin\m2.conf" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2018.1.3\lib\idea_rt.jar=5301:C:\Program Files\JetBrains\IntelliJ IDEA 2018.1.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA 2018.1.3\plugins\maven\lib\maven3\boot\plexus-classworlds-2.5.2.jar" org.codehaus.classworlds.Launcher -Didea.version=2018.1.3 -DskipTests=true install -f pom.xml [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for com.d-prototype.cn:SparkMe:jar:1.0-SNAPSHOT [WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.apache.spark:spark-sql_2.10:jar -> duplicate declaration of version ${spark.version} @ line 51, column 21 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building SparkMe 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ SparkMe --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ SparkMe --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- scala-maven-plugin:3.2.2:compile (default) @ SparkMe --- [WARNING] Expected all dependencies to require Scala version: 2.12.6 [WARNING] com.d-prototype.cn:SparkMe:1.0-SNAPSHOT requires scala version: 2.12.6 [WARNING] com.twitter:chill_2.10:0.5.0 requires scala version: 2.10.4 [WARNING] Multiple versions of scala libraries detected! [INFO] C:\Users\adamhuan\IdeaProjects\SparkMe\src\main\scala:-1: info: compiling [INFO] Compiling 1 source files to C:\Users\adamhuan\IdeaProjects\SparkMe\target\classes at 1526959085812 [ERROR] scalac error: bad option: '-make:transitive' [INFO] scalac -help gives more information [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 11.809 s [INFO] Finished at: 2018-05-22T11:18:07+08:00 [INFO] Final Memory: 22M/72M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.2.2:compile (default) on project SparkMe: wrap: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException Process finished with exit code 1 |
解决上述问题需要修改这么几个地方:
1.
2.
然后再次【run maven】就没问题了:
[……]