scalaConsole


(Monosij Dutta-Roy) #1

I am using Gradle 1.3 with Scala 2.10.

Trying to get scalaConsole to work. Tried: gradle scalaConsole.

It works but the console always has >Building > :scalaConsole in the command prompt. Also from the directory where Gradle is invoked 9where the gradle file is) imports don’t work since: package com… is in src/main/scala so importing the package does not find it from the gradle directory. … and also by defining the task console as:

task console(type: JavaExec, dependsOn: classes){

main = ‘org.scalaconsole.ScalaConsole’

args = “$projectDir”.split().toList()

classpath configurations.runtime } … Thank you for your help.


(Peter Niederwieser) #2

‘scalaConsole’ is a work in progress. It will be announced once it’s ready for general use.

It works but the console always has >Building > :scalaConsole in the command prompt.

It’s a known problem. Solving it will require improvements to Gradle’s general input handling.

Also from the directory where Gradle is invoked 9where the gradle file is) imports don’t work since: […]

I don’t understand what you are trying to say here. Can you elaborate?

and also by defining the task console as: […]

I don’t understand what you are trying to say here. Can you elaborate?


(Monosij Dutta-Roy) #3

Thank you Peter for your response. Curious as to when you are considering releasing it. In 1.4 or such or soon in 1.3.x? Also - I am using JVM 7 under Ubuntu 12.10 / 64 - in case you have a specific patch for this.

Regards your questions: … 1. Also from the directory where Gradle is invoked 9where the gradle file is) imports don’t work since: […] The Scala project is set up in a ROOT directory where the structure is: src/main/scala (for Scala classes / objects) src/test/scala (for test files) And the build.gradle file is in the ROOT dir. I invoke gradle - and it works fine (clean, build). Now I invoke: gradle scalaConsole. The console comes up (albeit with the issues). At the console I say import com.scalainaction.xxx. It responds: scala> {btw whatever I typed - the import statement, vanishes} > Build:7: error: object scalainaction is not a member of package com

import com.scalainaction I assumed that since I am building Scala from the ROOT it knows how to find com.scalainaction when I invoke from console. Hope that helps. … 2. and also by defining the task console as: […] In searching for scalaConsole issues on net I had found the task console as pasted above to generate the scalaConsole, but you can ignore this as you say scalaConsole is work in progress. … 3. I do have another question I posted earlier to which I did not get a response yet. As I mentioned I am using JDK 7 under Ubuntu 12.10 / 64. However when I do build with gradle and it builds fine it gives the messages: – :compileScala [ant:scalac] warning: -target:jvm-1.5 is deprecated: use target for Java 1.6 or above. [ant:scalac] one warning found :processResources UP-TO-DATE – It seems to me that JVM 1.5 is being used when I have JVM 7 installed? Is there a way to change this or I should ignore the message? The command: gradle -v generates: ------------------------------------------------------------ Gradle 1.3 ------------------------------------------------------------

Gradle build time: Tuesday, November 20, 2012 11:37:38 AM UTC Groovy: 1.8.6 Ant: Apache Ant™ version 1.8.4 compiled on May 22 2012 Ivy: 2.2.0 JVM: 1.7.0_09 (Oracle Corporation 23.2-b09) OS: Linux 3.5.0-21-generic amd64 – So it is using JVM 7 but then why is ant;scalac issuing the 1.5 warning? … Hope I have detailed as much as possible. Some maybe by ignorance as I am new to both Scala and Gradle.

Thank you for your help. Gradle is a great piece of software. More elegant for me than Ant or Maven. And its great that you have taken the task of integrating it firmly with Scala.

Regards.

Monosij


(Peter Niederwieser) #4

Curious as to when you are considering releasing it.

1.5 at the earliest.

However when I do build with gradle and it builds fine it gives the messages: […]

The warning occurs if the Scala compiler is instructed to generate Java 1.5 compliant byte code, which is deprecated. But prior to Scala 2.10, the ‘scalac’ Ant task doesn’t support anything else. The warning should go away once you upgrade to Scala 2.10 or set ‘scalaCompile.useAnt=false’ (provided that ‘project.targetCompatibility’ is set to higher than 1.5).


(Monosij Dutta-Roy) #5

Thanks Peter for your help. I am still getting the 1.5 warning. … My build file now has the following: apply plugin: ‘scala’ project.targetCompatibility = 1.7 compileScala.useAnt=false repositories {mavenCentral()} ext {scala = [version: ‘2.10.0’, group: ‘org.scala-lang’]} … But I still get the 1.5 warning: Creating properties on demand (a.k.a. dynamic properties) has been deprecated and is scheduled to be removed in Gradle 2.0. Please read http://gradle.org/docs/current/dsl/org.gradle.api.plugins.ExtraPropertiesExtension.html for information on the replacement for dynamic properties. Deprecated dynamic property: “useAnt” on “task ‘:compileScala’”, value: “false”. :clean :compileJava UP-TO-DATE :compileScala [ant:scalac] warning: -target:jvm-1.5 is deprecated: use target for Java 1.6 or above. … When is the 1.5 release scheduled for? If there is a beta I am happy to try it - or even Gradle 2.0.

Thank you again.

Monosij


(Monosij Dutta-Roy) #6

Hi Peter -

I also tried the following:

apply plugin: ‘scala’ targetCompatibility = 1.7 sourceCompatibility = 1.7 compileScala.useAnt=false

Thanks.

Monosij


(Peter Niederwieser) #7

It’s ‘compileScala.scalaCompileOptions.useAnt’.


(Monosij Dutta-Roy) #8

Thanks Peter. Worked well.

When should we expect 1.5?

Also when is Gradle 2.0 coming out? I have seen references to it in discussions? Is it a new architecture to address some of these issues?

Thanks again.

Monosij


(Peter Niederwieser) #9

There’s a new release roughly every 8 weeks. We are progressively introducing new features with every release, and 2.0 is not being discussed at this time.


(Monosij Dutta-Roy) #10

Thanks Peter. I thought I read somewhere that Gradle 2.0 is in development that’s why I asked. Maybe I mistook the statements I read.


(Giovanni Botta) #11

This is an old post so I was wondering what the status of ‘scalaConsole’ is right now?


(Peter Niederwieser) #12

It’s still an unofficial feature, blocked on improved Gradle console support.


(melody_dunn) #13

What is the status of this? I was hoping to switch from SBT to Gradle and this is a blocker. Seems to work except I can’t get completion working due to this error:

Failed to created JLineReader: java.lang.NoClassDefFoundError: scala/tools/jline/console/completer/Completer

If I add jline to my runtime dependencies, my cursor disappears in my Terminal (mac osx) and I am unable to see anything I type until I press enter. After that I have to shut down that instance of my terminal because it stays this way even after exiting scalaconsole.

This is a huge disappointment as it will make a switch to Gradle a show stopper.


(Ben Manes) #14

Instead of shutting down your terminal, simply type in “reset” and your console should be fixed.