Hi!
I had some problems with getting Jline (command line history) to work in the
scala shell when invoked
from "buildr shell".
It would complain with:
Failed to created JLineReader: java.lang.NoClassDefFoundError:
scala/tools/jline/console/ConsoleReader
Falling back to SimpleReader.
I solved it by adding a compile dependency to 'org.scala-lang:jline:jar:2.10.0'
Like so:
JLINE_FIX = 'org.scala-lang:jline:jar:2.10.0'
desc "The Scalatest project"
define "ScalaTest" do
compile.with JLINE_FIX
compile.options.target = '1.6'
package :jar
end
Regards,
Magnus
El 24 jan 2013, a las 08.41, Magnus Melander escribió:
> Thanks Alex!
> The patch works like a charm. Good going!
> I guess something similar is needed to get the Zinc/incremental compilation
> working with Scala 2.10 as well.
>
> Regards,
> Magnus
>
>
>
>
> El 23 jan 2013, a las 22.24, Alex Boisvert escribió:
>
>> I just committed a fix in trunk if you want to use that ... I'm attaching
>> the diff here if you want to apply locally instead.
>>
>> commit 7ea0538ab477370c9b440b6d0fbb5e0463482b34
>> Author: Alex Boisvert <[email protected]>
>> Date: Wed Jan 23 21:22:46 2013 +0000
>>
>> Basic support for Scala 2.10
>>
>> git-svn-id:
>> https://svn.apache.org/repos/asf/buildr/trunk@143774113f79535-47bb-0310-9956-ffa450edef68
>>
>> diff --git a/lib/buildr/scala/bdd.rb b/lib/buildr/scala/bdd.rb
>> index 9480015..6825134 100644
>> --- a/lib/buildr/scala/bdd.rb
>> +++ b/lib/buildr/scala/bdd.rb
>> @@ -137,7 +137,7 @@ module Buildr::Scala
>> when Buildr::Scala.version?("2.9")
>> '1.11'
>> else
>> - fail "No default specs2 version for Scala
>> #{Scala.version_without_build}"
>> + '1.12.3' # default for Scala 2.10 and beyond
>> end
>>
>> class << self
>> diff --git a/lib/buildr/scala/compiler.rb b/lib/buildr/scala/compiler.rb
>> index ea825f4..5121833 100644
>> --- a/lib/buildr/scala/compiler.rb
>> +++ b/lib/buildr/scala/compiler.rb
>> @@ -95,6 +95,11 @@ module Buildr::Scala
>> version = Buildr.settings.build['scala.version'] || DEFAULT_VERSION
>> ns.library! 'org.scala-lang:scala-library:jar:>=' + version
>> ns.compiler! 'org.scala-lang:scala-compiler:jar:>=' + version
>> + unless ::Buildr::Scala.version?(2.7, 2.8, 2.9)
>> + # added in Scala 2.10
>> + ns.reflect! 'org.scala-lang:scala-reflect:jar:>=' + version
>> + ns.actors! 'org.scala-lang:scala-actors:jar:>=' + version
>> + end
>> end
>>
>> ZINC_REQUIRES = ArtifactNamespace.for(self) do |ns|
>>
>>
>> On Wed, Jan 23, 2013 at 1:10 PM, Alex Boisvert
>> <[email protected]>wrote:
>>
>>> Oh yuck indeed. I'll fix this. Standby.
>>>
>>>
>>> On Wed, Jan 23, 2013 at 12:55 PM, Magnus Melander
>>> <[email protected]>wrote:
>>>
>>>> Hi!
>>>> I am using both Scala and Java in a buildr project.
>>>> The java code has source+target = 1.6
>>>> However, to get that to work, I must use the newest Scala, 2.10.0 since
>>>> older scala only supports target 1.5.
>>>>
>>>> When I run buildr, it crashes since the Specs2 case statement in bdd.rb
>>>> (line 140) does not handle 2.10 (
>>>>
>>>> Buildr aborted!
>>>> NameError : uninitialized constant Buildr::Scala::Specs2::Scala
>>>> /Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/ext/module.rb:36:in
>>>> `const_missing'
>>>> /Library/Ruby/Gems/1.8/gems/buildr-1.4.9/lib/buildr/scala/bdd.rb:140
>>>> /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in
>>>> `gem_original_require'
>>>> /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
>>>> /Library/Ruby/Gems/1.8/gems/buildr-1.4.9/lib/buildr/scala.rb:22
>>>> /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in
>>>> `gem_original_require'
>>>> /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
>>>> /Users/mange/git/ScalaTest/buildfile.rb:5
>>>> /Library/Ruby/Gems/1.8/gems/buildr-1.4.9/lib/buildr/core/application.rb:424:in
>>>> `load'
>>>> /Library/Ruby/Gems/1.8/gems/buildr-1.4.9/lib/buildr/core/application.rb:424:in
>>>> `raw_load_buildfile'
>>>> /Library/Ruby/Gems/1.8/gems/buildr-1.4.9/lib/buildr/core/application.rb:224:in
>>>> `load_buildfile'
>>>> /Library/Ruby/Gems/1.8/gems/buildr-1.4.9/lib/buildr/core/application.rb:534:in
>>>> `standard_exception_handling'
>>>> /Library/Ruby/Gems/1.8/gems/buildr-1.4.9/lib/buildr/core/application.rb:219:in
>>>> `load_buildfile'
>>>> /Library/Ruby/Gems/1.8/gems/buildr-1.4.9/lib/buildr/core/application.rb:129:in
>>>> `run'
>>>> /Library/Ruby/Gems/1.8/gems/buildr-1.4.9/lib/buildr/core/application.rb:534:in
>>>> `standard_exception_handling'
>>>> /Library/Ruby/Gems/1.8/gems/buildr-1.4.9/lib/buildr/core/application.rb:127:in
>>>> `run'
>>>> /Library/Ruby/Gems/1.8/gems/buildr-1.4.9/bin/buildr:19
>>>> /usr/bin/buildr:23:in `load'
>>>> /usr/bin/buildr:23
>>>>
>>>> I did a quick patch and added a "when" statement for 2.10, but that did
>>>> not help, I got:
>>>> Building ScalaTest
>>>> Compiling ScalaTest into /Users/mange/git/ScalaTest/target/classes
>>>> Buildr aborted!
>>>> RuntimeError : Scala compiler crashed:
>>>> #<NoClassDefFoundError: scala/reflect/internal/Trees>
>>>>
>>>> I think it has to do with some compiler classes having moved in Scala
>>>> 2.10 .
>>>>
>>>> Is there a quick solution for this?
>>>> I'd love to keep using buildr and not having to use another build tool.
>>>>
>>>>
>>>> Regards
>>>> Magnus
>>>>
>>>>
>>>
>