mvn scala:cc exits at first error

77 views
Skip to first unread message

Christophe Dehlinger

unread,
Nov 6, 2009, 3:09:56 AM11/6/09
to maven-a...@googlegroups.com
Hello,

I've been trying to compile using mvn scala:cc, without much success. All works well until one of the files has an error, at which point maven exits with a build error.

I use Lift's helloworld as a test project. If I put a syntax error in HelloWorld.scala, I get the following:

/stuff/prog/tmp/helloworld/helloworld$ mvn scala:cc -e
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building helloworld
[INFO]    task-segment: [scala:cc]
[INFO] ------------------------------------------------------------------------
[INFO] [scala:cc {execution: default-cli}]
[INFO] Checking for multiple versions of scala
[INFO] use fsc for compilation
[INFO] stop server(s)...
[No compilation server running.]
[INFO] start server...
[INFO] wait for files to compile...
[INFO] includes = [**/*.scala,]
[INFO] excludes = []
[INFO] 22:13 compiling HelloWorld.scala
/stuff/prog/tmp/helloworld/helloworld/src/main/scala/demo/helloworld/snippet/HelloWorld.scala:6: error: expected class or object definition
huei
^
one error found
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] wrap: org.apache.commons.exec.ExecuteException: Process exited with an error: 1(Exit value: 1)

[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: wrap: org.apache.commons.exec.ExecuteException: Process exited with an error: 1(Exit value: 1)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: wrap: org.apache.commons.exec.ExecuteException: Process exited with an error: 1(Exit value: 1)
    at org.scala_tools.maven.ScalaMojoSupport.execute(ScalaMojoSupport.java:331)
    at org.scala_tools.maven.ScalaCompilerSupport.execute(ScalaCompilerSupport.java:33)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
    ... 17 more
Caused by: org.apache.commons.exec.ExecuteException: Process exited with an error: 1(Exit value: 1)
    at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:346)
    at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:149)
    at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:136)
    at org.scala_tools.maven.executions.JavaMainCallerByFork.run(JavaMainCallerByFork.java:58)
    at org.scala_tools.maven.ScalaCompilerSupport.compile(ScalaCompilerSupport.java:151)
    at org.scala_tools.maven.ScalaCompilerSupport.compile(ScalaCompilerSupport.java:118)
    at org.scala_tools.maven.ScalaContinuousCompileMojo.doExecute(ScalaContinuousCompileMojo.java:137)
    at org.scala_tools.maven.ScalaMojoSupport.execute(ScalaMojoSupport.java:323)
    ... 20 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Thu Nov 05 22:13:45 CET 2009
[INFO] Final Memory: 12M/119M
[INFO] ------------------------------------------------------------------------
[INFO] stop server(s)...
[Compile server exited]




This was tested on two separate Ubuntu (9.04 and 9.10) machines, both with fresh scala installs. I was surprised that I needed to install scala first, as I expected maven to use the compiler jars in its repository. Maybe there was already something wrong there ?

I've had the same problem with other projects and another scala version (2.7.6-final). Actually, as I've never got scala:cc to work differently, I've started to wonder if it was not the expected behaviour. But that wouldn't fit the "infinite loop" description very well.

Has anybody had the same problem ? Is there some additional setup to do ?


David Bernard

unread,
Nov 6, 2009, 3:35:22 AM11/6/09
to maven-a...@googlegroups.com
Hi,

Exit when error on scala:cc is a bug. In fact this is a regression
(not tested sorry) introduce by the refactor of how to run external
tool. I'll fix it ASAP (next version 2.13 should provide other option
for scala:cc, work in progress)
With maven you don't need to install scala, maven don't use it (nor
SCALA_HOME). Why do you need to install ?

/davidB

Josh Suereth

unread,
Nov 6, 2009, 6:30:14 AM11/6/09
to maven-a...@googlegroups.com, maven-a...@googlegroups.com
Can you open a ticket on github? It's the davidB/maven-scala-plugin
project.

I'm hoping to set aside some time soon to clean this up.

Sent from my iPhone

On Nov 6, 2009, at 3:09 AM, Christophe Dehlinger <christoph...@gmail.com

Josh Suereth

unread,
Nov 6, 2009, 6:59:06 AM11/6/09
to maven-a...@googlegroups.com
Nevermind, as always, David is on it ;)

/stuff/prog/tmp/helloworld/helloworld/src/main/scala/demo/helloworld/snippet/HelloWorld.scala:6: error: expected class or object definition

huei
^
one error found
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] wrap: org.apache.commons.exec.ExecuteException: Process exited with an error: 1(Exit value: 1)

[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: wrap: org.apache.commons.exec.ExecuteException: Process exited with an error: 1(Exit value: 1)
   at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
   at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:569)
   at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:539)
   at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
   at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
   at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)

   at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
   at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
   at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
   at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)

   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
   at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
   at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)

   at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: wrap: org.apache.commons.exec.ExecuteException: Process exited with an error: 1(Exit value: 1)
   at org.scala_tools.maven.ScalaMojoSupport.execute(ScalaMojoSupport.java:331)
   at org.scala_tools.maven.ScalaCompilerSupport.execute(ScalaCompilerSupport.java:33)
   at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
   at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)

   ... 17 more
Caused by: org.apache.commons.exec.ExecuteException: Process exited with an error: 1(Exit value: 1)
   at org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:346)
   at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:149)
   at org.apache.commons.exec.DefaultExecutor.execute(DefaultExecutor.java:136)
   at org.scala_tools.maven.executions.JavaMainCallerByFork.run(JavaMainCallerByFork.java:58)
   at org.scala_tools.maven.ScalaCompilerSupport.compile(ScalaCompilerSupport.java:151)
   at org.scala_tools.maven.ScalaCompilerSupport.compile(ScalaCompilerSupport.java:118)
   at org.scala_tools.maven.ScalaContinuousCompileMojo.doExecute(ScalaContinuousCompileMojo.java:137)
   at org.scala_tools.maven.ScalaMojoSupport.execute(ScalaMojoSupport.java:323)

Christophe Dehlinger

unread,
Nov 6, 2009, 7:32:09 AM11/6/09
to maven-a...@googlegroups.com
Hi David,

Without a scala install, maven doesn't even manage to compile valid scala files. IIRC, maven complains that it cannot find scala.tools.nsc.CompileClient. I can try again tonight and send a stacktrace. Come to think of it, it might be due to helloworld's dependency on the compiler having a "test" scope, but I believe I also tested with a default scope.
mvn scala:compile works fine.

As to the scala:cc bug, do you have a workaround ? Should I use an older version ? Or simply scala:compile until 2.13 arrives ?

Christophe Dehlinger

unread,
Nov 6, 2009, 12:57:15 PM11/6/09
to maven-a...@googlegroups.com
Here's the stacktrace after sudo rm /usr/bin/scala /usr/bin/scalac /usr/bin/fsc.
Same result if I correct the error in HelloWorld.scala. But if I then run scala:compile followed by scala:cc, compilation works again (still crashing when the syntax error is put back into the file though, no miracles there).

Obviously scala:cc does use the scala compiler jars from the local repository. Still, as you can see, the stack traces with/without scala installed are slightly different: the former has a compiler syntax error message, the latter has the lines "Cannot start compilation daemon./tried command: scala scala.tools.nsc.CompileServer"


/stuff/prog/tmp/helloworld/helloworld$ mvn scala:cc -e
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building helloworld
[INFO]    task-segment: [scala:cc]
[INFO] ------------------------------------------------------------------------
[INFO] [scala:cc {execution: default-cli}]
[INFO] Checking for multiple versions of scala
[INFO] use fsc for compilation
[INFO] stop server(s)...
[No compilation server running.]
[INFO] start server...
[INFO] wait for files to compile...
[INFO] includes = [**/*.scala,]
[INFO] excludes = []
[INFO] 18:39 compiling HelloWorld.scala
Cannot start compilation daemon.
tried command: scala scala.tools.nsc.CompileServer
[INFO] Total time: 2 seconds
[INFO] Finished at: Fri Nov 06 18:39:02 CET 2009
[INFO] Final Memory: 12M/120M

[INFO] ------------------------------------------------------------------------
[INFO] stop server(s)...
[Compile server exited]


David Bernard

unread,
Nov 22, 2009, 3:25:10 PM11/22/09
to maven-a...@googlegroups.com
scala:cc bug is fixed in maven-scala-plugin 2.13

/davidB
Reply all
Reply to author
Forward
0 new messages