You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用playframework/play-java-seed.g8创建项目后出现大量警告求助

Fixing Warnings When Running a Play Java Seed Project with Java 9 & SBT 1.1.0

Hey there, let's tackle those warnings you're seeing when running your Play Java project. I'll break down each issue and show you how to resolve them step by step:

1. MaxPermSize Warning (Java 9 Compatibility)

The first repeated warning you encounter:

Java HotSpot(TM) 64-Bit Server VM warning: Ignoring option MaxPermSize; support was removed in 8.0

This happens because Java 8 and later replaced the PermGen space with Metaspace, making the MaxPermSize JVM flag obsolete. Here's how to fix it:

  • Find your SBT configuration file: this could be a global file like ~/.sbt/1.0/sbtopts (Linux/macOS) or C:\Users\<YourUsername>\.sbt\1.0\sbtopts (Windows), or a project-specific .sbtopts in your project root folder.
  • Open the file and delete any line containing -XX:MaxPermSize=....
  • If you want to set limits for the new Metaspace (optional but recommended), add these lines instead:
    -XX:MetaspaceSize=256m
    -XX:MaxMetaspaceSize=512m
    
  • Restart SBT for the changes to take effect.

2. Library Dependency Version Conflicts

The rest of the warnings are about version conflicts in third-party libraries (like Guava, Akka, Plexus Utils). Here's what you need to know:

  • These warnings are SBT's way of notifying you that it's selecting one version of a library over others to resolve conflicts. For Play Framework projects, the default selected versions are tested and compatible with the Play version you're using (2.6.15 in your case), so these warnings are usually safe to ignore for day-to-day development.
  • If you want to dive deeper into the conflicts and verify compatibility, run this command in your project directory:
    sbt evicted
    
    This will show you a detailed breakdown of which dependencies are causing conflicts and why a specific version was chosen.
  • If you need to enforce a specific version for a library (use this cautiously!), add a dependency override in your build.sbt file. For example, to lock in Guava 22.0 (the version Play 2.6.15 relies on), add:
    dependencyOverrides += "com.google.guava" % "guava" % "22.0"
    
    Note that overriding versions can introduce unexpected compatibility issues, so only do this if you're certain it's necessary.

Quick Environment Note

You're using Java 9.0.4 and SBT 1.1.0. Play 2.6.x has partial support for Java 9—you might run into minor edge cases. For a more stable experience, consider switching to Java 8 (LTS, fully supported by Play 2.6.x) or upgrading to a newer Play version with better Java 9+ compatibility.

内容的提问来源于stack exchange,提问作者Carlsen

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 09:08:40