Ant problem with 2.10M6

303 views
Skip to first unread message

Alan Burlison

unread,
Aug 3, 2012, 7:13:58 PM8/3/12
to scala...@googlegroups.com
I've just upgraded from 2.10M4 to 2.10M6 and my ant config which has
worked since 2.9 has stopped working. The error I'm getting is:

/home/alanbur/scala/OLS/build.xml:13: The following error occurred while
executing this line:
/home/alanbur/scala/OLS/build-scala.xml:14: The following error occurred
while executing this line:
jar:file:/opt/scala/lib/scala-compiler.jar!/scala/tools/ant/antlib.xml:5: taskdef
A class needed by class scala.tools.ant.FastScalac cannot be found:
scala/reflect/internal/settings/MutableSettings$SettingValue using the
classloader
AntClassLoader[/opt/scala/lib/scala-library.jar:/opt/scala/lib/scala-compiler.jar]

Anyone have any ideas?

Thanks,

--
Alan Burlison
--

Paolo Giarrusso

unread,
Aug 3, 2012, 9:56:39 PM8/3/12
to scala...@googlegroups.com
This will be solved by adding on the CLASSPATH $SCALA_HOME/lib/scala-reflect.jar:$SCALA_HOME/lib/scala-library.jar - before launching ant.

For instance, on a typical (Bourne) Unix shell, if CLASSPATH has already a value, you can type:

export CLASSPATH=$SCALA_HOME/lib/scala-reflect.jar:$SCALA_HOME/lib/scala-library.jar:$CLASSPATH

(replacing $SCALA_HOME by the actual path, probably).

I think that in fact for this problem, it's enough to have:

export CLASSPATH=$SCALA_HOME/lib/scala-reflect.jar:$CLASSPATH

but I also needed to add scala-library to fix a problem with running the tests.
In general, when upgrading to -M5 or -M6, take a look at $SCALA_HOME/lib/, since libraries have been split much more granularly. Actors have also been split out from the main library for various reasons (the Akka actor library is being integrated as an alternative, in some way).

Alan Burlison

unread,
Aug 7, 2012, 6:15:31 AM8/7/12
to Paolo Giarrusso, scala...@googlegroups.com
On 04/08/2012 02:56, Paolo Giarrusso wrote:

> This will be solved by adding on the CLASSPATH $SCALA_HOME/lib/
> scala-reflect.jar:$SCALA_HOME/lib/scala-library.jar - before launching ant.

That was the hint I needed, thanks. I've modified my ant file to add in
references to scala-reflect.jar as follows, and that's fixed the problem:

<property name="scala.home" value="/opt/scala"/>

<property name="scala.lib" value="${scala.home}/lib"/>
<property name="scala.compiler"
value="${scala.lib}/scala-compiler.jar"/>
<property name="scala.reflect" value="${scala.lib}/scala-reflect.jar"/>
<property name="scala.library" value="${scala.lib}/scala-library.jar"/>

<taskdef resource="scala/tools/ant/antlib.xml">
<classpath>
<pathelement location="${scala.library}"/>
<pathelement location="${scala.reflect}"/>
<pathelement location="${scala.compiler}"/>
</classpath>
</taskdef>

<target name="scala-compile">
<fsc
srcdir="${src.java.dir}:${src.scala.dir}"
destdir="${build.classes.dir}"
classpath="${javac.classpath}:${scala.library}"
target="jvm-${javac.target}"
deprecation="${javac.deprecation}"
unchecked="yes"
encoding="${source.encoding}"
addparams="-optimize -Xlint"
force="yes"
fork="no">
</fsc>
</target>

--
Alan Burlison
--

Alan Burlison

unread,
Aug 7, 2012, 8:22:22 AM8/7/12
to Alan Burlison, Paolo Giarrusso, scala...@googlegroups.com
On 07/08/2012 11:15, Alan Burlison wrote:

> That was the hint I needed, thanks. I've modified my ant file to add in
> references to scala-reflect.jar as follows, and that's fixed the problem:

I spoke too soon. It apparently works with the ant fsc task, but the
scalac task blows up:

uncaught exception during compilation: scala.reflect.internal.FatalError
scala.reflect.internal.FatalError: package reflect does not have a
member ClassManifest
at
scala.reflect.internal.Definitions$DefinitionsClass.scala$reflect$internal$Definitions$DefinitionsClass$$fatalMissingSymbol(Definitions.scala:979)
at
scala.reflect.internal.Definitions$DefinitionsClass$$anonfun$getMember$1.apply(Definitions.scala:1008)
at
scala.reflect.internal.Definitions$DefinitionsClass$$anonfun$getMember$1.apply(Definitions.scala:1003)
at scala.reflect.internal.Symbols$Symbol.orElse(Symbols.scala:2332)
at
scala.reflect.internal.Definitions$DefinitionsClass.getMember(Definitions.scala:1002)
at
scala.reflect.internal.Definitions$DefinitionsClass.getMemberType(Definitions.scala:1027)
at
scala.reflect.internal.Definitions$DefinitionsClass.PartialManifestClass$lzycompute(Definitions.scala:467)
at
scala.reflect.internal.Definitions$DefinitionsClass.PartialManifestClass(Definitions.scala:467)
at
scala.tools.nsc.typechecker.Implicits$ImplicitSearch.<init>(Implicits.scala:1221)
at
scala.tools.nsc.typechecker.Implicits$class.inferImplicit(Implicits.scala:82)
at scala.tools.nsc.Global$$anon$1.inferImplicit(Global.scala:488)
at
scala.tools.nsc.typechecker.Implicits$class.inferImplicit(Implicits.scala:37)
at scala.tools.nsc.Global$$anon$1.inferImplicit(Global.scala:488)
at
scala.tools.nsc.typechecker.Typers$Typer$$anonfun$applyImplicitArgs$2.apply(Typers.scala:133)
at
scala.tools.nsc.typechecker.Typers$Typer$$anonfun$applyImplicitArgs$2.apply(Typers.scala:128)
at
scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:78)
[rest of stack trace snipped]

The same code compiles fine with scalac from the command-line. Any
suggestions of how to track this down?

Alan Burlison

unread,
Aug 7, 2012, 11:59:46 AM8/7/12
to Alan Burlison, Paolo Giarrusso, scala...@googlegroups.com
On 07/08/2012 13:22, Alan Burlison wrote:

> I spoke too soon. It apparently works with the ant fsc task, but the
> scalac task blows up:

Logged as https://issues.scala-lang.org/browse/SI-6203

--
Alan Burlison
--

Josh Suereth

unread,
Aug 7, 2012, 12:14:41 PM8/7/12
to Alan Burlison, Paolo Giarrusso, scala...@googlegroups.com
Can we get some more info here?  I can't even begin to look into it without some kind of *small* reproducible test case.

- Josh

Alan Burlison

unread,
Aug 7, 2012, 12:30:15 PM8/7/12
to Josh Suereth, Paolo Giarrusso, scala...@googlegroups.com
On 07/08/2012 17:14, Josh Suereth wrote:

> Can we get some more info here? I can't even begin to look into it without
> some kind of *small* reproducible test case.

Absolutely, working on it now.

--
Alan Burlison
--

workingDog

unread,
Sep 1, 2012, 6:51:11 PM9/1/12
to scala...@googlegroups.com, Josh Suereth, Paolo Giarrusso
Alan,

could you post the solution please. I could not really understand "The fix is to delete and recreate the Scala NetBeans libraries and the project references to them and make sure that the versions of the libraries that end up in $PROJECT/lib correspond to the scalac version you are using."

I can't even remove the scala platform from Netbeans. 

Alan Burlison

unread,
Sep 3, 2012, 5:09:46 AM9/3/12
to workingDog, scala...@googlegroups.com, Josh Suereth, Paolo Giarrusso
On 01/09/2012 23:51, workingDog wrote:

> could you post the solution please. I could not really understand "The fix
> is to delete and recreate the Scala NetBeans libraries and the project
> references to them and make sure that the versions of the libraries that
> end up in $PROJECT/lib correspond to the scalac version you are using."

NetBeans usually keeps a local copy of scala-library.jar inside your
project. If you update the scala version, it doesn't get updated so you
get all sorts of oddness because of the mismatch - and because scala is
self-hosted, that includes compile-time oddness, not just run-time
oddness. That's why you need to manually clean up any old copies that
are lying around and make sure everything matches version-wise.

--
Alan Burlison
--
Reply all
Reply to author
Forward
0 new messages