"No main class detected" when running Play app, after upgrading Scala plugin
I'm not sure if it's related to upgrading or not, but after restarting IntelliJ for the new Scala plugin, my project won't start. I just get "Main class not found" error. How do I get IntelliJ to find the main entry point of my Play app? Not sure how this got screwed up because it was working yesterday.
请先登录再写评论。
FWIW, here is what I get when I build:
Information:Play 2 Compiler: Loading project definition from /Users/sbergam/gh/wg-staging2/project
Information:Play 2 Compiler: Set current project to wg-staging2 (in build file:/Users/sbergam/gh/wg-staging2/)
Information:Play 2 Compiler: Compiling 13 Scala sources and 1 Java source to /Users/sbergam/gh/wg-staging2/api/target/scala-2.11/classes...
Information:Play 2 Compiler: Compiling 4 Java sources to /Users/sbergam/gh/wg-staging2/PolarisSearch/target/scala-2.11/classes...
Information:Play 2 Compiler: Compiling 10 Java sources to /Users/sbergam/gh/wg-staging2/setupproductimageurl/target/scala-2.11/classes...
Information:Play 2 Compiler: Compiling 9 Scala sources to /Users/sbergam/gh/wg-staging2/pocs/restclient/target/scala-2.11/classes...
Information:Play 2 Compiler: Compiling 13 Scala sources and 1 Java source to /Users/sbergam/gh/wg-staging2/api/target/scala-2.11/classes...
Information:Play 2 Compiler: Compiling 22 Scala sources to /Users/sbergam/gh/wg-staging2/pi/target/scala-2.11/classes...
Information:Play 2 Compiler: Compiling 3 Scala sources to /Users/sbergam/gh/wg-staging2/pocs/olif/target/scala-2.11/classes...
Information:Play 2 Compiler: Compiling 1 Scala source to /Users/sbergam/gh/wg-staging2/pocs/restclient/target/scala-2.11/test-classes...
Information:Play 2 Compiler: Compiling 2 Scala sources to /Users/sbergam/gh/wg-staging2/pi/target/scala-2.11/test-classes...
Information:Play 2 Compiler: [success] Total time: 22 s, completed Mar 22, 2015 1:43:58 PM
Information:Play 2 Compiler: [success] Total time: 1 s, completed Mar 22, 2015 1:44:07 PM
Information:3/22/15, 1:44 PM - Compilation completed successfully with 13 warnings in 48 sec
Warning:Play 2 Compiler: Scala version was updated by one of library dependencies:
Warning:Play 2 Compiler: * org.scala-lang:scala-library:(2.11.5, 2.11.2, 2.11.1, 2.11.4) -> 2.11.6
Warning:Play 2 Compiler: To force scalaVersion, add the following:
Warning:Play 2 Compiler: ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }
Warning:Play 2 Compiler: Run 'evicted' to see detailed eviction warnings
Warning:Play 2 Compiler: * org.scala-lang:scala-library:(2.11.5, 2.11.0, 2.11.2, 2.11.1, 2.11.4) -> 2.11.6
Warning:Play 2 Compiler: * org.scala-lang:scala-library:(2.11.1, 2.11.5, 2.11.0, 2.11.2, 2.11.4) -> 2.11.6
Warning:Play 2 Compiler: there were two feature warnings; re-run with -feature for details
Warning:Play 2 Compiler: one warning found
Warning:Play 2 Compiler: there were three feature warnings; re-run with -feature for details
Warning:Play 2 Compiler: there were three deprecation warnings; re-run with -deprecation for details
Warning:Play 2 Compiler: there was one feature warning; re-run with -feature for details
Warning:Play 2 Compiler: two warnings found
and here is what I get when I try to run:
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:58218,suspend=y,server=n -Dfile.encoding=UTF8 -Dconfig.file=api/conf/dev.conf -Djline.terminal=none -Dsbt.log.noformat=true -Dsbt.global.base=/private/var/folders/26/w1wbrtwx0wg6sqd2lvz31p4m8vh7jg/T/sbt-global-plugin3stub -Xms512M -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M -javaagent:/Users/sbergam/Library/Caches/IntelliJIdea14/groovyHotSwap/gragent.jar -classpath "/Users/sbergam/Library/Application Support/IntelliJIdea14/Scala/launcher/sbt-launch.jar:/Applications/IntelliJ IDEA 14.app/Contents/lib/idea_rt.jar" xsbt.boot.Boot ~run
Connected to the target VM, address: '127.0.0.1:58218', transport: 'socket'
[info] Loading project definition from /Users/sbergam/gh/wg-staging2/project
[info] Set current project to wg-staging2 (in build file:/Users/sbergam/gh/wg-staging2/)
[warn] No main class detected
java.lang.RuntimeException: No main class detected.
at scala.sys.package$.error(package.scala:27)
[trace] Stack trace suppressed: run 'last wg-staging2/compile:run' for the full output.
[error] (wg-staging2/compile:run) No main class detected.
[error] Total time: 0 s, completed Mar 22, 2015 1:41:28 PM
1. Waiting for source changes... (press enter to interrupt)
Broken by version 1.4 of Scala plugin. Not sure if 100% related, but see https://youtrack.jetbrains.com/issue/SCL-8484.
A workaround is to downgrade the plugin to some older version.
How can I install the older plugin? I tried downloading "1.3.3.16-14.1." from https://plugins.jetbrains.com/plugin/?id=1347 but I don't know how to install it. It's just a zip file. If I try to do it from inside IntelliJ using "Install plugin from disk..." it says it's not compatible. I am running 14.0.3
1.3.3.16-14.1 is for IDEA 14.1 (there is some EAP or RC I think). There is a link 'show all updates' below the table with plugin versions. Click it and the page will show all versions, download 1.3.3. Or you can use this direct link: https://plugins.jetbrains.com/plugin/download?pr=&updateId=18635.
We will update plugin 1.4.1 tomorrow with fix. Sorry for inconveniences.
Best regards,
Alexander Podkhalyuzin.