This page is no longer maintained — Please continue to the home page at www.scala-lang.org

maven-scala-plugin: scala:console does not work

5 replies
asdfgh-v6ak
Joined: 2010-12-22,
User offline. Last seen 42 years 45 weeks ago.

Hello,
I'm thying maven-scala-plugin and it seems to work except mvn
scala:console. It allways fails:

Welcome to Scala version 2.8.1.final (Java HotSpot(TM) 64-Bit Server
VM, Java 1.6.0_23).
Type in expressions to have them evaluated.
Type :help for more information.

scala>
Failed to initialize compiler: object scala not found.
** Note that as of 2.8 scala does not assume use of the java
classpath.
** For the old behavior pass -usejavacp to scala, or if using a
Settings
** object programatically, settings.usejavacp.value = true.

I've figured out (using -X) that there is missing JVM argument
-Dscala.home=/usr/share/scala, but I don't know how to add it.

Do you have an idea?

Thanks,
Vít Šesták 'v6ak'

david.bernard
Joined: 2009-01-08,
User offline. Last seen 1 year 27 weeks ago.
Re: maven-scala-plugin: scala:console does not work
What is your OS ?What is your version of maven-scala-plugin ?-Dscala.home=/usr/share/scala is useless, maven-scala-plugin doen't use your local scala installation.

on my box (Linux) :
➜  vscaladoc2_demoprj git:(master) ✗ mvn scala:console [INFO] Scanning for projects...[INFO]                                                                          [INFO] ------------------------------------------------------------------------[INFO] Building vscaladoc2_demoprj 0.1-SNAPSHOT [INFO] ------------------------------------------------------------------------[INFO]  [INFO] --- maven-scala-plugin:2.15.0:console (default-cli) @ vscaladoc2_demoprj ---[INFO] Checking for multiple versions of scala [WARNING] maven-scala-plugin cannot fork scala console!!  Running in process[WARNING] jvmArgs are ignored when run in process :-classpath [WARNING] jvmArgs are ignored when run in process :Welcome to Scala version 2.8.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_20). Type in expressions to have them evaluated.Type :help for more information.
scala> 




2010/12/22 asdfgh-v6ak <asdfgh-v6ak@soukroma.cz>
Hello,
I'm thying maven-scala-plugin and it seems to work except mvn
scala:console. It allways fails:

Welcome to Scala version 2.8.1.final (Java HotSpot(TM) 64-Bit Server
VM, Java 1.6.0_23).
Type in expressions to have them evaluated.
Type :help for more information.

scala>
Failed to initialize compiler: object scala not found.
** Note that as of 2.8 scala does not assume use of the java
classpath.
** For the old behavior pass -usejavacp to scala, or if using a
Settings
** object programatically, settings.usejavacp.value = true.


I've figured out (using -X) that there is missing JVM argument
-Dscala.home=/usr/share/scala, but I don't know how to add it.

Do you have an idea?

Thanks,
Vít Šesták 'v6ak'


asdfgh-v6ak
Joined: 2010-12-22,
User offline. Last seen 42 years 45 weeks ago.
Re: maven-scala-plugin: scala:console does not work

$ uname -a
Linux ntb 2.6.35-ZEN #1 ZEN SMP PREEMPT Mon Sep 27 18:10:48 CEST
2010 x86_64 Intel(R) Core(TM)2 Duo CPU T6570 @ 2.10GHz GenuineIntel
GNU/Linux

There is clip from my pom.xml: http://pastebin.com/GdxKu8B8

I know that Scala in my system is not used, but I've experimented
with it. If I replace "exec" with "echo" in /usr/bin/scala, I get
following command:
/opt/java/bin/java -Xmx256M -Xms32M -cp
/usr/share/scala/lib/jline.jar:/usr/share/scala/lib/scala-compiler.jar:/usr/share/scala/lib/scala-dbc.jar:/usr/share/scala/lib/scala-library.jar:/usr/share/scala/lib/scala-partest.jar:/usr/share/scala/lib/scalap.jar:/usr/share/scala/lib/scala-swing.jar
-Dscala.home=/usr/share/scala -Denv.emacs=
scala.tools.nsc.MainGenericRunner

When I run it as is, it works. When I ommit
"-Dscala.home=/usr/share/scala", it dows not work (looks like with
Maven). I can also try to add -X to mvn args ($
/opt/maven-2.2.1/bin/mvn -X scala:console) and see the command:
/opt/java/jre/bin/java -classpath /repository/org/scala-lang/scala-compiler/2.8.1/scala-compiler-2.8.1.jar:/target/classes:/repository/org/scala-lang/scala-library/2.8.1/scala-library-2.8.1.jar:/target/test-classes
scala.tools.nsc.MainGenericRunner

When I add -Dscala.home=/usr/share/scala/, it starts working.

Note that:
$ pacman -Q scala{,-{doc,src}}
scala 2.8.1-1
scala-doc 2.8.1-1
scala-src 2.8.1-1

Thanks,
Vít Šesták 'v6ak'

On 22.12.2010 10:48, David Bernard wrote:
> What is your OS ?
> What is your version of maven-scala-plugin ?
> -Dscala.home=/usr/share/scala is useless, maven-scala-plugin
> doen't use your local scala installation.
> >
> on my box (Linux) :
>
> ➜ vscaladoc2_demoprj git:(master) ✗ mvn scala:console
> [INFO] Scanning for projects...
> [INFO]
>
> > [INFO]
> ------------------------------------------------------------------------
> > > [INFO] Building vscaladoc2_demoprj 0.1-SNAPSHOT
> [INFO]
> ------------------------------------------------------------------------
> > > [INFO]
> [INFO] --- maven-scala-plugin:2.15.0:console (default-cli) @
> vscaladoc2_demoprj ---
> > [INFO] Checking for multiple versions of scala
> [WARNING] maven-scala-plugin cannot fork scala console!! Running
> in process
> > [WARNING] jvmArgs are ignored when run in process :-classpath
> [WARNING] jvmArgs are ignored when run in process :
> Welcome to Scala version 2.8.1.final (Java HotSpot(TM) 64-Bit
> Server VM, Java 1.6.0_20).
> > Type in expressions to have them evaluated.
> Type :help for more information.
>
> scala>
>
>
>
>
>
> 2010/12/22 asdfgh-v6ak
>
> Hello,
> I'm thying maven-scala-plugin and it seems to work except mvn
> scala:console. It allways fails:
>
> Welcome to Scala version 2.8.1.final (Java HotSpot(TM) 64-Bit
> Server
> > VM, Java 1.6.0_23).
> Type in expressions to have them evaluated.
> Type :help for more information.
>
> scala>
> Failed to initialize compiler: object scala not found.
> ** Note that as of 2.8 scala does not assume use of the java
> classpath.
> ** For the old behavior pass -usejavacp to scala, or if using
> a
> > Settings
> ** object programatically, settings.usejavacp.value = true.
>
>
> I've figured out (using -X) that there is missing JVM argument
> -Dscala.home=/usr/share/scala, but I don't know how to add it.
>
> Do you have an idea?
>
> Thanks,
> Vít Šesták 'v6ak'
>
>

david.bernard
Joined: 2009-01-08,
User offline. Last seen 1 year 27 weeks ago.
Re: maven-scala-plugin: scala:console does not work
can you try with a more recent version of maven-scala-plugin : 2.9 -> 2.15.0

On Wed, Dec 22, 2010 at 17:41, asdfgh-v6ak <asdfgh-v6ak@soukroma.cz> wrote:
$ uname -a
Linux ntb 2.6.35-ZEN #1 ZEN SMP PREEMPT Mon Sep 27 18:10:48 CEST
2010 x86_64 Intel(R) Core(TM)2 Duo CPU T6570 @ 2.10GHz GenuineIntel
GNU/Linux

There is clip from my pom.xml: http://pastebin.com/GdxKu8B8

I know that Scala in my system is not used, but I've experimented
with it. If I replace "exec" with "echo" in /usr/bin/scala, I get
following command:
/opt/java/bin/java -Xmx256M -Xms32M -cp
/usr/share/scala/lib/jline.jar:/usr/share/scala/lib/scala-compiler.jar:/usr/share/scala/lib/scala-dbc.jar:/usr/share/scala/lib/scala-library.jar:/usr/share/scala/lib/scala-partest.jar:/usr/share/scala/lib/scalap.jar:/usr/share/scala/lib/scala-swing.jar
-Dscala.home=/usr/share/scala -Denv.emacs=
scala.tools.nsc.MainGenericRunner

When I run it as is, it works. When I ommit
"-Dscala.home=/usr/share/scala", it dows not work (looks like with
Maven). I can also try to add -X to mvn args ($
/opt/maven-2.2.1/bin/mvn -X scala:console) and see the command:
/opt/java/jre/bin/java -classpath <M2
HOME>/repository/org/scala-lang/scala-compiler/2.8.1/scala-compiler-2.8.1.jar:<PROJECT>/target/classes:<M2
HOME>/repository/org/scala-lang/scala-library/2.8.1/scala-library-2.8.1.jar:<PROJECT>/target/test-classes
scala.tools.nsc.MainGenericRunner

When I add  -Dscala.home=/usr/share/scala/, it starts working.

Note that:
$ pacman -Q scala{,-{doc,src}}
scala 2.8.1-1
scala-doc 2.8.1-1
scala-src 2.8.1-1

Thanks,
Vít Šesták 'v6ak'

On 22.12.2010 10:48, David Bernard wrote:
> What is your OS ?
> What is your version of maven-scala-plugin ?
> -Dscala.home=/usr/share/scala is useless, maven-scala-plugin
> doen't use your local scala installation.
> >
> on my box (Linux) :
>
> ➜  vscaladoc2_demoprj git:(master) ✗ mvn scala:console
> [INFO] Scanning for projects...
> [INFO]
>
> > [INFO]
> ------------------------------------------------------------------------
> > > [INFO] Building vscaladoc2_demoprj 0.1-SNAPSHOT
> [INFO]
> ------------------------------------------------------------------------
> > > [INFO]
> [INFO] --- maven-scala-plugin:2.15.0:console (default-cli) @
> vscaladoc2_demoprj ---
> > [INFO] Checking for multiple versions of scala
> [WARNING] maven-scala-plugin cannot fork scala console!!  Running
> in process
> > [WARNING] jvmArgs are ignored when run in process :-classpath
> [WARNING] jvmArgs are ignored when run in process :
> Welcome to Scala version 2.8.1.final (Java HotSpot(TM) 64-Bit
> Server VM, Java 1.6.0_20).
> > Type in expressions to have them evaluated.
> Type :help for more information.
>
> scala>
>
>
>
>
>
> 2010/12/22 asdfgh-v6ak <asdfgh-v6ak@soukroma.cz>
>
>     Hello,
>     I'm thying maven-scala-plugin and it seems to work except mvn
>     scala:console. It allways fails:
>
>     Welcome to Scala version 2.8.1.final (Java HotSpot(TM) 64-Bit
>     Server
>     >     VM, Java 1.6.0_23).
>     Type in expressions to have them evaluated.
>     Type :help for more information.
>
>     scala>
>     Failed to initialize compiler: object scala not found.
>     ** Note that as of 2.8 scala does not assume use of the java
>     classpath.
>     ** For the old behavior pass -usejavacp to scala, or if using
>     a
>     >     Settings
>     ** object programatically, settings.usejavacp.value = true.
>
>
>     I've figured out (using -X) that there is missing JVM argument
>     -Dscala.home=/usr/share/scala, but I don't know how to add it.
>
>     Do you have an idea?
>
>     Thanks,
>     Vít Šesták 'v6ak'
>
>

david.bernard
Joined: 2009-01-08,
User offline. Last seen 1 year 27 weeks ago.
Re: maven-scala-plugin: scala:console does not work
optional, upgrade to maven 3.0.x
/davidB

On Wed, Dec 22, 2010 at 20:04, David Bernard <david.bernard.31@gmail.com> wrote:
can you try with a more recent version of maven-scala-plugin : 2.9 -> 2.15.0

On Wed, Dec 22, 2010 at 17:41, asdfgh-v6ak <asdfgh-v6ak@soukroma.cz> wrote:
$ uname -a
Linux ntb 2.6.35-ZEN #1 ZEN SMP PREEMPT Mon Sep 27 18:10:48 CEST
2010 x86_64 Intel(R) Core(TM)2 Duo CPU T6570 @ 2.10GHz GenuineIntel
GNU/Linux

There is clip from my pom.xml: http://pastebin.com/GdxKu8B8

I know that Scala in my system is not used, but I've experimented
with it. If I replace "exec" with "echo" in /usr/bin/scala, I get
following command:
/opt/java/bin/java -Xmx256M -Xms32M -cp
/usr/share/scala/lib/jline.jar:/usr/share/scala/lib/scala-compiler.jar:/usr/share/scala/lib/scala-dbc.jar:/usr/share/scala/lib/scala-library.jar:/usr/share/scala/lib/scala-partest.jar:/usr/share/scala/lib/scalap.jar:/usr/share/scala/lib/scala-swing.jar
-Dscala.home=/usr/share/scala -Denv.emacs=
scala.tools.nsc.MainGenericRunner

When I run it as is, it works. When I ommit
"-Dscala.home=/usr/share/scala", it dows not work (looks like with
Maven). I can also try to add -X to mvn args ($
/opt/maven-2.2.1/bin/mvn -X scala:console) and see the command:
/opt/java/jre/bin/java -classpath <M2
HOME>/repository/org/scala-lang/scala-compiler/2.8.1/scala-compiler-2.8.1.jar:<PROJECT>/target/classes:<M2
HOME>/repository/org/scala-lang/scala-library/2.8.1/scala-library-2.8.1.jar:<PROJECT>/target/test-classes
scala.tools.nsc.MainGenericRunner

When I add  -Dscala.home=/usr/share/scala/, it starts working.

Note that:
$ pacman -Q scala{,-{doc,src}}
scala 2.8.1-1
scala-doc 2.8.1-1
scala-src 2.8.1-1

Thanks,
Vít Šesták 'v6ak'

On 22.12.2010 10:48, David Bernard wrote:
> What is your OS ?
> What is your version of maven-scala-plugin ?
> -Dscala.home=/usr/share/scala is useless, maven-scala-plugin
> doen't use your local scala installation.
> >
> on my box (Linux) :
>
> ➜  vscaladoc2_demoprj git:(master) ✗ mvn scala:console
> [INFO] Scanning for projects...
> [INFO]
>
> > [INFO]
> ------------------------------------------------------------------------
> > > [INFO] Building vscaladoc2_demoprj 0.1-SNAPSHOT
> [INFO]
> ------------------------------------------------------------------------
> > > [INFO]
> [INFO] --- maven-scala-plugin:2.15.0:console (default-cli) @
> vscaladoc2_demoprj ---
> > [INFO] Checking for multiple versions of scala
> [WARNING] maven-scala-plugin cannot fork scala console!!  Running
> in process
> > [WARNING] jvmArgs are ignored when run in process :-classpath
> [WARNING] jvmArgs are ignored when run in process :
> Welcome to Scala version 2.8.1.final (Java HotSpot(TM) 64-Bit
> Server VM, Java 1.6.0_20).
> > Type in expressions to have them evaluated.
> Type :help for more information.
>
> scala>
>
>
>
>
>
> 2010/12/22 asdfgh-v6ak <asdfgh-v6ak@soukroma.cz>
>
>     Hello,
>     I'm thying maven-scala-plugin and it seems to work except mvn
>     scala:console. It allways fails:
>
>     Welcome to Scala version 2.8.1.final (Java HotSpot(TM) 64-Bit
>     Server
>     >     VM, Java 1.6.0_23).
>     Type in expressions to have them evaluated.
>     Type :help for more information.
>
>     scala>
>     Failed to initialize compiler: object scala not found.
>     ** Note that as of 2.8 scala does not assume use of the java
>     classpath.
>     ** For the old behavior pass -usejavacp to scala, or if using
>     a
>     >     Settings
>     ** object programatically, settings.usejavacp.value = true.
>
>
>     I've figured out (using -X) that there is missing JVM argument
>     -Dscala.home=/usr/share/scala, but I don't know how to add it.
>
>     Do you have an idea?
>
>     Thanks,
>     Vít Šesták 'v6ak'
>
>


asdfgh-v6ak
Joined: 2010-12-22,
User offline. Last seen 42 years 45 weeks ago.
Re: maven-scala-plugin: scala:console does not work

Thank you, it was such a stupid mistake. Alphabetic order is
sometimes confusing (
http://repo1.maven.org/maven2/org/scala-tools/maven-scala-plugin/ )
:D

I've migrated to Maven 3. Probably all issues connected with using
Maven 3 were caused by old plugin version.

Command mvn scala:console works OK now.

Command mvn scala:cc sometimes complans “[INFO] Could not connect to
compilation daemon.”, but it can be solved by "fsc -reset".

Using mvn scala:console with JRebel works with workaround:
MAVEN_OPTS="-noverify
-javaagent:/usr/local/ZeroTurnaround/JRebel/jrebel.jar" mvn
scala:console

So, it is not ideal, but it works :)

Vít Šesták 'v6ak'

On 22.12.2010 20:04, David Bernard wrote:
> can you try with a more recent version of maven-scala-plugin : 2.9
> -> 2.15.0
> >
> On Wed, Dec 22, 2010 at 17:41, asdfgh-v6ak
> wrote:
> >
> $ uname -a
> Linux ntb 2.6.35-ZEN #1 ZEN SMP PREEMPT Mon Sep 27 18:10:48
> CEST
> > 2010 x86_64 Intel(R) Core(TM)2 Duo CPU T6570 @ 2.10GHz
> GenuineIntel
> > GNU/Linux
>
> There is clip from my pom.xml: http://pastebin.com/GdxKu8B8
>
> I know that Scala in my system is not used, but I've
> experimented
> > with it. If I replace "exec" with "echo" in /usr/bin/scala, I
> get
> > following command:
> /opt/java/bin/java -Xmx256M -Xms32M -cp
> /usr/share/scala/lib/jline.jar:/usr/share/scala/lib/scala-compiler.jar:/usr/share/scala/lib/scala-dbc.jar:/usr/share/scala/lib/scala-library.jar:/usr/share/scala/lib/scala-partest.jar:/usr/share/scala/lib/scalap.jar:/usr/share/scala/lib/scala-swing.jar
> > > -Dscala.home=/usr/share/scala -Denv.emacs=
> scala.tools.nsc.MainGenericRunner
>
> When I run it as is, it works. When I ommit
> "-Dscala.home=/usr/share/scala", it dows not work (looks like
> with
> > Maven). I can also try to add -X to mvn args ($
> /opt/maven-2.2.1/bin/mvn -X scala:console) and see the
> command:
> > /opt/java/jre/bin/java -classpath
> HOME>/repository/org/scala-lang/scala-compiler/2.8.1/scala-compiler-2.8.1.jar:/target/classes:
> > > HOME>/repository/org/scala-lang/scala-library/2.8.1/scala-library-2.8.1.jar:/target/test-classes
> > > > scala.tools.nsc.MainGenericRunner
>
> When I add -Dscala.home=/usr/share/scala/, it starts working.
>
> Note that:
> $ pacman -Q scala{,-{doc,src}}
> scala 2.8.1-1
> scala-doc 2.8.1-1
> scala-src 2.8.1-1
>
> Thanks,
> Vít Šesták 'v6ak'
>
> On 22.12.2010 10:48, David Bernard wrote:
> > What is your OS ?
> > What is your version of maven-scala-plugin ?
> > -Dscala.home=/usr/share/scala is useless, maven-scala-plugin
> > doen't use your local scala installation.
> > >
> > on my box (Linux) :
> >
> > ➜ vscaladoc2_demoprj git:(master) ✗ mvn scala:console
> > [INFO] Scanning for projects...
> > [INFO]
> >
> > > [INFO]
> > ------------------------------------------------------------------------
> > > > > > > > [INFO] Building vscaladoc2_demoprj 0.1-SNAPSHOT
> > [INFO]
> > ------------------------------------------------------------------------
> > > > > > > > [INFO]
> > [INFO] --- maven-scala-plugin:2.15.0:console (default-cli) @
> > vscaladoc2_demoprj ---
> > > [INFO] Checking for multiple versions of scala
> > [WARNING] maven-scala-plugin cannot fork scala console!!
> > Running
> > > > in process
> > > [WARNING] jvmArgs are ignored when run in process
> > > :-classpath
> > > > > [WARNING] jvmArgs are ignored when run in process :
> > Welcome to Scala version 2.8.1.final (Java HotSpot(TM)
> > 64-Bit
> > > > Server VM, Java 1.6.0_20).
> > > Type in expressions to have them evaluated.
> > Type :help for more information.
> >
> > scala>
> >
> >
> >
> >
> >
> > 2010/12/22 asdfgh-v6ak
> >
> > Hello,
> > I'm thying maven-scala-plugin and it seems to work
> > except mvn
> > > > scala:console. It allways fails:
> >
> > Welcome to Scala version 2.8.1.final (Java HotSpot(TM)
> > 64-Bit
> > > > Server
> > > VM, Java 1.6.0_23).
> > Type in expressions to have them evaluated.
> > Type :help for more information.
> >
> > scala>
> > Failed to initialize compiler: object scala not found.
> > ** Note that as of 2.8 scala does not assume use of the
> > java
> > > > classpath.
> > ** For the old behavior pass -usejavacp to scala, or if
> > using
> > > > a
> > > Settings
> > ** object programatically, settings.usejavacp.value =
> > true.
> > > >
> >
> > I've figured out (using -X) that there is missing JVM
> > argument
> > > > -Dscala.home=/usr/share/scala, but I don't know how to
> > add it.
> > > >
> > Do you have an idea?
> >
> > Thanks,
> > Vít Šesták 'v6ak'
> >
> >
>
>

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland