IntelliJ中「UNRESOLVED DEPENDENCIES」问题排查求助
Hey there! I see you're diving into Spark, Scala, and Hadoop—awesome stack to learn! Let's get that SBT issue sorted out so you can keep building your project.
First, let's break down what's happening: that warning about ignoring MaxPermSize is because Java 8 and later versions removed the Permanent Generation (PermGen) space entirely, replacing it with Metaspace. Any JVM arguments referencing MaxPermSize are now obsolete, which is why your SBT setup is throwing that warning.
Your Current build.sbt Config
name := "untitled2" version := "0.1" scalaVersion := "2.12.5" val sparkVersion = "2.3.0" libraryDependencies ++= Seq( "org.apache.spark" %% "spark-core" % sparkVersion )
The Error You're Seeing
Error while importing sbt project: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPer...
How to Fix This
Here are a few straightforward steps to resolve the warning:
- Check your Java version: Run
java -versionin your terminal to confirm you're using Java 8 or newer. If you're on an older version (like Java 7), consider upgrading since Spark 2.3.0 supports Java 8+ anyway. - Update SBT's JVM configuration:
- In your project root directory, create a file named
.sbtopts(if it doesn't exist already). - Open it and remove any line that includes
-XX:MaxPermSize=.... If you need to adjust memory settings for Metaspace, use-XX:MaxMetaspaceSize=256m(or your preferred value) instead.
- In your project root directory, create a file named
- Fix IDE-specific settings (if using IntelliJ/Eclipse):
- In IntelliJ, go to
File > Settings > Build, Execution, Deployment > Build Tools > sbt. - Under the "JVM options" section, delete any reference to
MaxPermSize. - Click "Apply" and reimport your SBT project.
- In IntelliJ, go to
Once you make these changes, refresh your SBT project again—the warning should disappear, and your dependencies should import correctly.
内容的提问来源于stack exchange,提问作者JeanP

