pantsbuild / pants

The Pants Build System
https://www.pantsbuild.org
Apache License 2.0
3.33k stars 637 forks source link

scala compile sad: NoClassDefFoundError: scala/ScalaObject #50

Closed lahosken closed 10 years ago

lahosken commented 10 years ago

(various cleaning operations that escalated in levels of desperation culminating in a clean.sh and a 'git clean -fdx') ./pants goal compile src/scala/com/pants/example:jvm-run-example-lib

results in

14:28:39 00:00 [compile] 14:28:39 00:00 [zinc] java.lang.NoClassDefFoundError: scala/ScalaObject at java.lang.ClassLoader.defineClass1(Native Method)

This reminds me of something that happened in Twitter-internal a few weeks back. The (workaround? fix?) for that was to edit pants.ini to add 3rdparty:scala-library to some 'deps'

Full majestic stack trace follows:

$ ./pants goal compile src/scala/com/pants/example:jvm-run-example-lib

14:35:48 00:00 [main](To run a reporting server: ./pants server) 14:35:48 00:00 [setup] 14:35:48 00:00 [bootstrap] 14:35:48 00:00 [parse] 14:35:48 00:00 [bootstrap] 14:35:48 00:00 [bootstrap-jvm-tools] 14:35:48 00:00 [gen] 14:35:48 00:00 [thrift] 14:35:48 00:00 [scrooge] 14:35:48 00:00 [protoc] 14:35:48 00:00 [antlr] 14:35:48 00:00 [check-exclusives] 14:35:48 00:00 [check-exclusives] 14:35:48 00:00 [resolve] 14:35:48 00:00 [ivy] 14:35:48 00:00 [compile] 14:35:48 00:00 [jvm] 14:35:48 00:00 [scala] Invalidated 1 target containing 1 source file. 14:35:48 00:00 [find-deleted-sources] Compiling a partition containing 1 source in 1 target. 14:35:48 00:00 [compile] 14:35:48 00:00 [zinc] java.lang.NoClassDefFoundError: scala/ScalaObject at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:270) at sbt.compiler.AnalyzingCompiler.getInterfaceClass(AnalyzingCompiler.scala:117) at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:99) at sbt.compiler.AnalyzingCompiler.newCachedCompiler(AnalyzingCompiler.scala:57) at sbt.compiler.AnalyzingCompiler.newCachedCompiler(AnalyzingCompiler.scala:52) at sbt.compiler.CompilerCache$$anon$2.apply(CompilerCache.scala:50) at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:39) at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply$mcV$sp(AggressiveCompile.scala:98) at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:98) at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:98) at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:159) at sbt.compiler.AggressiveCompile$$anonfun$3.compileScala$1(AggressiveCompile.scala:97) at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:142) at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:86) at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:39) at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:37) at sbt.inc.IncrementalCommon.cycle(Incremental.scala:93) at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:38) at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:37) at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:58) at sbt.inc.Incremental$.compile(Incremental.scala:37) at sbt.inc.IncrementalCompile$.apply(Compile.scala:27) at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:150) at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:70) at com.typesafe.zinc.Compiler.compile(Compiler.scala:184) at com.typesafe.zinc.Main$.run(Main.scala:98) at com.typesafe.zinc.Main$.main(Main.scala:15) at com.typesafe.zinc.Main.main(Main.scala) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.martiansoftware.nailgun.NGSession.run(NGSession.java:280) Caused by: java.lang.ClassNotFoundException: scala.ScalaObject at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 45 more [info] Compiling 1 Scala source to /Users/lhosken/workspace/pants/.pants.d/scalac/classes...

FAILURE: Zinc compile failed.

           Waiting for background workers to finish.
           FAILURE
stuhood commented 10 years ago

This reminds me of something that happened in Twitter-internal a few weeks back. The (workaround? fix?) for that was to edit pants.ini to add 3rdparty:scala-library to some 'deps'

Yea, this is likely related. Nothing is providing the scala-library dep for you.

On Mon, Apr 14, 2014 at 2:37 PM, Larry Hosken notifications@github.comwrote:

(various cleaning operations that escalated in levels of desperation culminating in a clean.sh and a 'git clean -fdx') ./pants goal compile src/scala/com/pants/example:jvm-run-example-lib

results in

14:28:39 00:00 [compile] 14:28:39 00:00 [zinc] java.lang.NoClassDefFoundError: scala/ScalaObject at java.lang.ClassLoader.defineClass1(Native Method)

This reminds me of something that happened in Twitter-internal a few weeks back. The (workaround? fix?) for that was to edit pants.ini to add 3rdparty:scala-library to some 'deps'

Full majestic stack trace follows:

$ ./pants goal compile src/scala/com/pants/example:jvm-run-example-lib

14:35:48 00:00 main 14:35:48 00:00 [setup] 14:35:48 00:00 [bootstrap] 14:35:48 00:00 [parse] 14:35:48 00:00 [bootstrap] 14:35:48 00:00 [bootstrap-jvm-tools] 14:35:48 00:00 [gen] 14:35:48 00:00 [thrift] 14:35:48 00:00 [scrooge] 14:35:48 00:00 [protoc] 14:35:48 00:00 [antlr] 14:35:48 00:00 [check-exclusives] 14:35:48 00:00 [check-exclusives] 14:35:48 00:00 [resolve] 14:35:48 00:00 [ivy] 14:35:48 00:00 [compile] 14:35:48 00:00 [jvm] 14:35:48 00:00 [scala] Invalidated 1 target containing 1 source file. 14:35:48 00:00 [find-deleted-sources] Compiling a partition containing 1 source in 1 target. 14:35:48 00:00 [compile] 14:35:48 00:00 [zinc] java.lang.NoClassDefFoundError: scala/ScalaObject at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:270) at sbt.compiler.AnalyzingCompiler.getInterfaceClass(AnalyzingCompiler.scala:117) at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:99) at sbt.compiler.AnalyzingCompiler.newCachedCompiler(AnalyzingCompiler.scala:57) at sbt.compiler.AnalyzingCompiler.newCachedCompiler(AnalyzingCompiler.scala:52) at sbt.compiler.CompilerCache$$anon$2.apply(CompilerCache.scala:50) at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:39) at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply$mcV$sp(AggressiveCompile.scala:98) at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:98) at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:98) at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:159) at sbt.compiler.AggressiveCompile$$anonfun$3.compileScala$1(AggressiveCompile.scala:97) at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:142) at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:86) at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:39) at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:37) at sbt.inc.IncrementalCommon.cycle(Incremental.scala:93) at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:38) at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:37) at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:58) at sbt.inc.Incremental$.compile(Incremental.scala:37) at sbt.inc.IncrementalCompile$.apply(Compile.scala:27) at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:150) at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:70) at com.typesafe.zinc.Compiler.compile(Compiler.scala:184) at com.typesafe.zinc.Main$.run(Main.scala:98) at com.typesafe.zinc.Main$.main(Main.scala:15) at com.typesafe.zinc.Main.main(Main.scala) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.martiansoftware.nailgun.NGSession.run(NGSession.java:280) Caused by: java.lang.ClassNotFoundException: scala.ScalaObject at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 45 more [info] Compiling 1 Scala source to /Users/lhosken/workspace/pants/.pants.d/scalac/classes...

FAILURE: Zinc compile failed.

       Waiting for background workers to finish.
       FAILURE

Reply to this email directly or view it on GitHubhttps://github.com/pantsbuild/pants/issues/50 .

@stuhood https://twitter.com/stuhood

benjyw commented 10 years ago

Actually I had a change a couple of weeks ago that makes jvm_compile add the scala library to the classpath. So I'm not sure if that's it.

On Mon, Apr 14, 2014 at 2:40 PM, Stu Hood notifications@github.com wrote:

This reminds me of something that happened in Twitter-internal a few weeks back. The (workaround? fix?) for that was to edit pants.ini to add 3rdparty:scala-library to some 'deps'

Yea, this is likely related. Nothing is providing the scala-library dep for you.

On Mon, Apr 14, 2014 at 2:37 PM, Larry Hosken <notifications@github.com

wrote:

(various cleaning operations that escalated in levels of desperation culminating in a clean.sh and a 'git clean -fdx') ./pants goal compile src/scala/com/pants/example:jvm-run-example-lib

results in

14:28:39 00:00 [compile] 14:28:39 00:00 [zinc] java.lang.NoClassDefFoundError: scala/ScalaObject at java.lang.ClassLoader.defineClass1(Native Method)

This reminds me of something that happened in Twitter-internal a few weeks back. The (workaround? fix?) for that was to edit pants.ini to add 3rdparty:scala-library to some 'deps'

Full majestic stack trace follows:

$ ./pants goal compile src/scala/com/pants/example:jvm-run-example-lib

14:35:48 00:00 main 14:35:48 00:00 [setup] 14:35:48 00:00 [bootstrap] 14:35:48 00:00 [parse] 14:35:48 00:00 [bootstrap] 14:35:48 00:00 [bootstrap-jvm-tools] 14:35:48 00:00 [gen] 14:35:48 00:00 [thrift] 14:35:48 00:00 [scrooge] 14:35:48 00:00 [protoc] 14:35:48 00:00 [antlr] 14:35:48 00:00 [check-exclusives] 14:35:48 00:00 [check-exclusives] 14:35:48 00:00 [resolve] 14:35:48 00:00 [ivy] 14:35:48 00:00 [compile] 14:35:48 00:00 [jvm] 14:35:48 00:00 [scala] Invalidated 1 target containing 1 source file. 14:35:48 00:00 [find-deleted-sources] Compiling a partition containing 1 source in 1 target. 14:35:48 00:00 [compile] 14:35:48 00:00 [zinc] java.lang.NoClassDefFoundError: scala/ScalaObject at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:270) at

sbt.compiler.AnalyzingCompiler.getInterfaceClass(AnalyzingCompiler.scala:117) at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:99) at

sbt.compiler.AnalyzingCompiler.newCachedCompiler(AnalyzingCompiler.scala:57) at

sbt.compiler.AnalyzingCompiler.newCachedCompiler(AnalyzingCompiler.scala:52) at sbt.compiler.CompilerCache$$anon$2.apply(CompilerCache.scala:50) at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:39) at

sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply$mcV$sp(AggressiveCompile.scala:98) at

sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:98) at

sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:98) at

sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:159) at

sbt.compiler.AggressiveCompile$$anonfun$3.compileScala$1(AggressiveCompile.scala:97) at

sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:142) at

sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:86) at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:39) at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:37) at sbt.inc.IncrementalCommon.cycle(Incremental.scala:93) at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:38) at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:37) at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:58) at sbt.inc.Incremental$.compile(Incremental.scala:37) at sbt.inc.IncrementalCompile$.apply(Compile.scala:27) at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:150) at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:70) at com.typesafe.zinc.Compiler.compile(Compiler.scala:184) at com.typesafe.zinc.Main$.run(Main.scala:98) at com.typesafe.zinc.Main$.main(Main.scala:15) at com.typesafe.zinc.Main.main(Main.scala) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at

sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at

sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.martiansoftware.nailgun.NGSession.run(NGSession.java:280) Caused by: java.lang.ClassNotFoundException: scala.ScalaObject at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 45 more [info] Compiling 1 Scala source to /Users/lhosken/workspace/pants/.pants.d/scalac/classes...

FAILURE: Zinc compile failed.

Waiting for background workers to finish. FAILURE

Reply to this email directly or view it on GitHub< https://github.com/pantsbuild/pants/issues/50> .

@stuhood https://twitter.com/stuhood

— Reply to this email directly or view it on GitHubhttps://github.com/pantsbuild/pants/issues/50#issuecomment-40421830 .

lahosken commented 10 years ago

Passed in -ldebug as I should have done in the first place. (Maybe interesting, maybe a red herring: it mentions more than one scala-library, different versions?)

DEBUG] Executing via NailgunClient(host=u'localhost', port=52467, work_dir='/Users/lhosken/workspace/pants'): /usr/bin/java -Xmx2g -XX:MaxPermSize=256m -Dzinc.analysis.cache.limit=0 -cp /Users/lhosken/workspace/pants/.pants.d/classpath/jars/com.typesafe.zinc/zinc/javadocs/zinc-0.3.2-M1-javadoc.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/com.typesafe.zinc/zinc/jars/zinc-0.3.2-M1.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/com.typesafe.zinc/zinc/sources/zinc-0.3.2-M1-sources.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/jars/scala-library-2.10.3.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/com.typesafe.sbt/incremental-compiler/jars/incremental-compiler-0.13.2-M1.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.10.3.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-reflect/jars/scala-reflect-2.10.3.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/com.typesafe.sbt/sbt-interface/jars/sbt-interface-0.13.2-M1.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/com.typesafe.sbt/compiler-interface/jars/compiler-interface-0.13.2-M1-sources.jar com.typesafe.zinc.Main -log-level debug -sbt-interface /Users/lhosken/workspace/pants/.pants.d/classpath/jars/com.typesafe.sbt/sbt-interface/jars/sbt-interface-0.13.2-M1.jar -compiler-interface /Users/lhosken/workspace/pants/.pants.d/classpath/jars/com.typesafe.sbt/compiler-interface/jars/compiler-interface-0.13.2-M1-sources.jar -scala-path /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/javadocs/scala-compiler-2.9.3-javadoc.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/sources/scala-compiler-2.9.3-sources.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/sources/scala-library-2.9.3-sources.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/jars/scala-library-2.9.3.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/javadocs/scala-library-2.9.3-javadoc.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/jline/jars/jline-2.9.3.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.fusesource.jansi/jansi/jars/jansi-1.4.jar -S-encoding -SUTF-8 -S-g:vars -S-deprecation -S-unchecked -analysis-cache /Users/lhosken/workspace/pants/.pants.d/scalac/analysis/artifact_cache_tmpdir/8927ca34-321c-44d0-ba9e-848acfeb92c3/src.scala.com.pants.example.jvm-run-example-lib/analysis -classpath /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/javadocs/scala-compiler-2.9.3-javadoc.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/sources/scala-compiler-2.9.3-sources.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/sources/scala-library-2.9.3-sources.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/jars/scala-library-2.9.3.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/javadocs/scala-library-2.9.3-javadoc.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/jline/jars/jline-2.9.3.jar:/Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.fusesource.jansi/jansi/jars/jansi-1.4.jar:/Users/lhosken/workspace/pants/.pants.d/scalac/resources:/Users/lhosken/workspace/pants/.pants.d/scalac/classes -d /Users/lhosken/workspace/pants/.pants.d/scalac/classes src/scala/com/pants/example/JvmRunExample.scala

tejal29 commented 10 years ago

I am seeing the same issue.

I See scala-compiler-2.9.3 on the classpath. However, scala library points to sources "/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/sources/scala-library-2.9.3-sources.jar"

I think this is the cause of the erorr.

                         [debug]    scala compiler = /Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar
                         [debug]    scala library = /Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/sources/scala-library-2.9.3-sources.jar
                         [debug]    scala extra = {
                         [debug]       /Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/jline/jars/jline-2.9.3.jar
                         [debug]       /Users/tdesai/projects/pants/.pants.d/classpath/jars/org.fusesource.jansi/jansi/jars/jansi-1.4.jar
                         [debug]    }
                         [debug]    sbt interface = /Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/sbt-interface/jars/sbt-interface-0.13.2-M1.jar
                         [debug]    compiler interface sources = /Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/compiler-interface/jars/compiler-interface-0.13.2-M1-sources.jar
                         [debug]    java home = 
                         [debug]    fork java = false
                         [debug]    cache directory = /Users/tdesai/.zinc/0.3.2-M1
                         [debug] }
                         [debug] Inputs = {
                         [debug]    classpath = {
                         [debug]       /Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar
                         [debug]       /Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/javadocs/scala-compiler-2.9.3-javadoc.jar
                         [debug]       /Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/sources/scala-compiler-2.9.3-sources.jar
                         [debug]       /Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/sources/scala-library-2.9.3-sources.jar
                         [debug]       /Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/jars/scala-library-2.9.3.jar
                         [debug]       /Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/javadocs/scala-library-2.9.3-javadoc.jar
                         [debug]       /Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/jline/jars/jline-2.9.3.jar
                         [debug]       /Users/tdesai/projects/pants/.pants.d/classpath/jars/org.fusesource.jansi/jansi/jars/jansi-1.4.jar
                         [debug]       /Users/tdesai/projects/pants/.pants.d/scalac/resources
                         [debug]       /Users/tdesai/projects/pants/.pants.d/scalac/classes
                         [debug]    }
                         [debug]    sources = {
                         [debug]       /Users/tdesai/projects/pants/src/scala/com/pants/example/JvmRunExample.scala
                         [debug]    }
lahosken commented 10 years ago

Pasting that part of my -ldebug output in case it helps people who actually understand these things

                     [debug] Setup = {
                     [debug]    scala compiler = /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar
                     [debug]    scala library = /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/sources/scala-library-2.9.3-sources.jar
                     [debug]    scala extra = {
                     [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/jline/jars/jline-2.9.3.jar
                     [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.fusesource.jansi/jansi/jars/jansi-1.4.jar
                     [debug]    }
                     [debug]    sbt interface = /Users/lhosken/workspace/pants/.pants.d/classpath/jars/com.typesafe.sbt/sbt-interface/jars/sbt-interface-0.13.2-M1.jar
                     [debug]    compiler interface sources = /Users/lhosken/workspace/pants/.pants.d/classpath/jars/com.typesafe.sbt/compiler-interface/jars/compiler-interface-0.13.2-M1-sources.jar
                     [debug]    java home = 
                     [debug]    fork java = false
                     [debug]    cache directory = /Users/lhosken/.zinc/0.3.2-M1
                     [debug] }
                     [debug] Inputs = {
                     [debug]    classpath = {
                     [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar
                     [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/javadocs/scala-compiler-2.9.3-javadoc.jar
                     [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/sources/scala-compiler-2.9.3-sources.jar
                     [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/sources/scala-library-2.9.3-sources.jar
                     [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/jars/scala-library-2.9.3.jar
                     [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/javadocs/scala-library-2.9.3-javadoc.jar
                     [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/jline/jars/jline-2.9.3.jar
                     [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.fusesource.jansi/jansi/jars/jansi-1.4.jar
                     [debug]       /Users/lhosken/workspace/pants/.pants.d/scalac/resources
                     [debug]       /Users/lhosken/workspace/pants/.pants.d/scalac/classes
                     [debug]    }
                     [debug]    sources = {
                     [debug]       /Users/lhosken/workspace/pants/src/scala/com/pants/example/JvmRunExample.scala
                     [debug]    }
                     [debug]    output directory = /Users/lhosken/workspace/pants/.pants.d/scalac/classes
                     [debug]    scalac options = {
                     [debug]       -encoding
                     [debug]       UTF-8
                     [debug]       -g:vars
                     [debug]       -deprecation
                     [debug]       -unchecked
                     [debug]    }
                     [debug]    javac options = {}
                     [debug]    cache file = /Users/lhosken/workspace/pants/.pants.d/scalac/analysis/artifact_cache_tmpdir/f77663cd-8ac9-40b7-a225-1a68b86d3962/src.scala.com.pants.example.jvm-run-example-lib/analysis
                     [debug]    analysis map = {
                     [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar = Analysis: 
                     [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/javadocs/scala-library-2.9.3-javadoc.jar = Analysis: 
                                                                                                                                                   [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/sources/scala-compiler-2.9.3-sources.jar = Analysis: 
                     [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/jars/scala-library-2.9.3.jar = Analysis: 
                     [debug]       /Users/lhosken/workspace/pants/.pants.d/scalac/classes = Analysis: 
                     [debug]       /Users/lhosken/workspace/pants/.pants.d/scalac/resources = Analysis: 
                     [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.fusesource.jansi/jansi/jars/jansi-1.4.jar = Analysis: 
                     [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/sources/scala-library-2.9.3-sources.jar = Analysis: 
                     [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/javadocs/scala-compiler-2.9.3-javadoc.jar = Analysis: 
                     [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/jline/jars/jline-2.9.3.jar = Analysis: 
                     [debug]    }
                     [debug]    force clean = false
                     [debug]    java only = false
                     [debug]    compile order = Mixed
                     [debug]    incremental compiler options = {
                     [debug]       transitive step = 3
                     [debug]       recompile all fraction = 0.5
                     [debug]       debug relations = false
                     [debug]       debug api = false
                     [debug]       api dump = 
                     [debug]       api diff context size = 5
                     [debug]       transactional = false
                     [debug]       backup directory = 
                     [debug]       recompile on macro def = true
                     [debug]       name hashing = false
                     [debug]    }
                     [debug]    output relations = 
                     [debug]    output products = 
                     [debug] }
benjyw commented 10 years ago

Sorry, I misunderstood the problem - the change I was referring to adds scala-library to the classpath for running, not for compiling.

However scala-library should always be on the classpath when compiling, so I'm confused. I'll try and reproduce.

On Mon, Apr 14, 2014 at 4:29 PM, Larry Hosken notifications@github.comwrote:

Pasting that part of my -ldebug output in case it helps people who actually understand these things

                 [debug] Setup = {
                 [debug]    scala compiler = /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar
                 [debug]    scala library = /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/sources/scala-library-2.9.3-sources.jar
                 [debug]    scala extra = {
                 [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/jline/jars/jline-2.9.3.jar
                 [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.fusesource.jansi/jansi/jars/jansi-1.4.jar
                 [debug]    }
                 [debug]    sbt interface = /Users/lhosken/workspace/pants/.pants.d/classpath/jars/com.typesafe.sbt/sbt-interface/jars/sbt-interface-0.13.2-M1.jar
                 [debug]    compiler interface sources = /Users/lhosken/workspace/pants/.pants.d/classpath/jars/com.typesafe.sbt/compiler-interface/jars/compiler-interface-0.13.2-M1-sources.jar
                 [debug]    java home =
                 [debug]    fork java = false
                 [debug]    cache directory = /Users/lhosken/.zinc/0.3.2-M1
                 [debug] }
                 [debug] Inputs = {
                 [debug]    classpath = {
                 [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar
                 [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/javadocs/scala-compiler-2.9.3-javadoc.jar
                 [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/sources/scala-compiler-2.9.3-sources.jar
                 [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/sources/scala-library-2.9.3-sources.jar
                 [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/jars/scala-library-2.9.3.jar
                 [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/javadocs/scala-library-2.9.3-javadoc.jar
                 [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/jline/jars/jline-2.9.3.jar
                 [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.fusesource.jansi/jansi/jars/jansi-1.4.jar
                 [debug]       /Users/lhosken/workspace/pants/.pants.d/scalac/resources
                 [debug]       /Users/lhosken/workspace/pants/.pants.d/scalac/classes
                 [debug]    }
                 [debug]    sources = {
                 [debug]       /Users/lhosken/workspace/pants/src/scala/com/pants/example/JvmRunExample.scala
                 [debug]    }
                 [debug]    output directory = /Users/lhosken/workspace/pants/.pants.d/scalac/classes
                 [debug]    scalac options = {
                 [debug]       -encoding
                 [debug]       UTF-8
                 [debug]       -g:vars
                 [debug]       -deprecation
                 [debug]       -unchecked
                 [debug]    }
                 [debug]    javac options = {}
                 [debug]    cache file = /Users/lhosken/workspace/pants/.pants.d/scalac/analysis/artifact_cache_tmpdir/f77663cd-8ac9-40b7-a225-1a68b86d3962/src.scala.com.pants.example.jvm-run-example-lib/analysis
                 [debug]    analysis map = {
                 [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar = Analysis:
                 [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/javadocs/scala-library-2.9.3-javadoc.jar = Analysis:
                                                                                                                                               [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/sources/scala-compiler-2.9.3-sources.jar = Analysis:
                 [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/jars/scala-library-2.9.3.jar = Analysis:
                 [debug]       /Users/lhosken/workspace/pants/.pants.d/scalac/classes = Analysis:
                 [debug]       /Users/lhosken/workspace/pants/.pants.d/scalac/resources = Analysis:
                 [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.fusesource.jansi/jansi/jars/jansi-1.4.jar = Analysis:
                 [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/sources/scala-library-2.9.3-sources.jar = Analysis:
                 [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/javadocs/scala-compiler-2.9.3-javadoc.jar = Analysis:
                 [debug]       /Users/lhosken/workspace/pants/.pants.d/classpath/jars/org.scala-lang/jline/jars/jline-2.9.3.jar = Analysis:
                 [debug]    }
                 [debug]    force clean = false
                 [debug]    java only = false
                 [debug]    compile order = Mixed
                 [debug]    incremental compiler options = {
                 [debug]       transitive step = 3
                 [debug]       recompile all fraction = 0.5
                 [debug]       debug relations = false
                 [debug]       debug api = false
                 [debug]       api dump =
                 [debug]       api diff context size = 5
                 [debug]       transactional = false
                 [debug]       backup directory =
                 [debug]       recompile on macro def = true
                 [debug]       name hashing = false
                 [debug]    }
                 [debug]    output relations =
                 [debug]    output products =
                 [debug] }

— Reply to this email directly or view it on GitHubhttps://github.com/pantsbuild/pants/issues/50#issuecomment-40430281 .

tejal29 commented 10 years ago

If I change the order of jar in the zinc Command generated, it fixes this issue.

The following command works:

/Library/JAVA/Home/bin/java -Xmx2g -XX:MaxPermSize=256m \
-Dzinc.analysis.cache.limit=0 \
-cp /Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.zinc/zinc/javadocs/zinc-0.3.2-M1-javadoc.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.zinc/zinc/jars/zinc-0.3.2-M1.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.zinc/zinc/sources/zinc-0.3.2-M1-sources.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/jars/scala-library-2.10.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/incremental-compiler/jars/incremental-compiler-0.13.2-M1.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.10.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-reflect/jars/scala-reflect-2.10.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/sbt-interface/jars/sbt-interface-0.13.2-M1.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/compiler-interface/jars/compiler-interface-0.13.2-M1-sources.jar com.typesafe.zinc.Main \
-log-level debug \
-sbt-interface /Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/sbt-interface/jars/sbt-interface-0.13.2-M1.jar \
-compiler-interface /Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/compiler-interface/jars/compiler-interface-0.13.2-M1-sources.jar \
-scala-path /Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/javadocs/scala-compiler-2.9.3-javadoc.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/sources/scala-compiler-2.9.3-sources.jar: \
/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/jars/scala-library-2.9.3.jar: \ 
/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/sources/scala-library-2.9.3-sources.jar: \
/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/javadocs/scala-library-2.9.3-javadoc.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/jline/jars/jline-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.fusesource.jansi/jansi/jars/jansi-1.4.jar \
-S-encoding \
 -SUTF-8 \
-S-g:vars -S-deprecation \
-S-unchecked \
-analysis-cache /Users/tdesai/projects/pants/.pants.d/scalac/analysis/artifact_cache_tmpdir/5ea3c8f4-b3bc-4811-85d8-a74d22d3e936/src.scala.com.pants.example.jvm-run-example-lib/analysis \
-classpath /Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/javadocs/scala-compiler-2.9.3-javadoc.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/sources/scala-compiler-2.9.3-sources.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/sources/scala-library-2.9.3-sources.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/jars/scala-library-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/javadocs/scala-library-2.9.3-javadoc.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/jline/jars/jline-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.fusesource.jansi/jansi/jars/jansi-1.4.jar:/Users/tdesai/projects/pants/.pants.d/scalac/resources:/Users/tdesai/projects/pants/.pants.d/scalac/classes \
-d /Users/tdesai/projects/pants/.pants.d/scalac/classes \
 src/scala/com/pants/example/JvmRunExample.scala

Vs the one generated by pants

/Library/JAVA/Home/bin/java -Xmx2g -XX:MaxPermSize=256m \
-Dzinc.analysis.cache.limit=0 \
-cp /Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.zinc/zinc/javadocs/zinc-0.3.2-M1-javadoc.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.zinc/zinc/jars/zinc-0.3.2-M1.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.zinc/zinc/sources/zinc-0.3.2-M1-sources.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/jars/scala-library-2.10.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/incremental-compiler/jars/incremental-compiler-0.13.2-M1.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.10.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-reflect/jars/scala-reflect-2.10.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/sbt-interface/jars/sbt-interface-0.13.2-M1.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/compiler-interface/jars/compiler-interface-0.13.2-M1-sources.jar com.typesafe.zinc.Main \
-log-level debug \
-sbt-interface /Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/sbt-interface/jars/sbt-interface-0.13.2-M1.jar \
-compiler-interface /Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/compiler-interface/jars/compiler-interface-0.13.2-M1-sources.jar \
-scala-path /Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/javadocs/scala-compiler-2.9.3-javadoc.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/sources/scala-compiler-2.9.3-sources.jar: \
/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/jars/scala-library-2.9.3-sources.jar: \
/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/sources/scala-library-2.9.3.jar: \
/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/javadocs/scala-library-2.9.3-javadoc.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/jline/jars/jline-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.fusesource.jansi/jansi/jars/jansi-1.4.jar \
-S-encoding \
 -SUTF-8 \
-S-g:vars -S-deprecation \
-S-unchecked \
-analysis-cache /Users/tdesai/projects/pants/.pants.d/scalac/analysis/artifact_cache_tmpdir/5ea3c8f4-b3bc-4811-85d8-a74d22d3e936/src.scala.com.pants.example.jvm-run-example-lib/analysis \
-classpath /Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/javadocs/scala-compiler-2.9.3-javadoc.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/sources/scala-compiler-2.9.3-sources.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/sources/scala-library-2.9.3-sources.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/jars/scala-library-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/javadocs/scala-library-2.9.3-javadoc.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/jline/jars/jline-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.fusesource.jansi/jansi/jars/jansi-1.4.jar:/Users/tdesai/projects/pants/.pants.d/scalac/resources:/Users/tdesai/projects/pants/.pants.d/scalac/classes \
-d /Users/tdesai/projects/pants/.pants.d/scalac/classes \
 src/scala/com/pants/example/JvmRunExample.scala

The major difference is the order of scala-library-sources and scala-library is changed in -scala-path

benjyw commented 10 years ago

The sources jar shouldn't be there, but I have an idea of why it is.

On Mon, Apr 14, 2014 at 4:38 PM, tejal29 notifications@github.com wrote:

If I change the order of jar in the zinc Command generated, it fixes this issue.

The following command works:

/Library/JAVA/Home/bin/java -Xmx2g -XX:MaxPermSize=256m \ -Dzinc.analysis.cache.limit=0 \ -cp /Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.zinc/zinc/javadocs/zinc-0.3.2-M1-javadoc.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.zinc/zinc/jars/zinc-0.3.2-M1.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.zinc/zinc/sources/zinc-0.3.2-M1-sources.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/jars/scala-library-2.10.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/incremental-compiler/jars/incremental-compiler-0.13.2-M1.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.10.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-reflect/jars/scala-reflect-2.10.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/sbt-interface/jars/sbt-interface-0.13.2-M1.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/compiler-interface /jars/compiler-interface-0.13.2-M1-sources.jar com.typesafe.zinc.Main \ -log-level debug \ -sbt-interface /Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/sbt-interface/jars/sbt-interface-0.13.2-M1.jar \ -compiler-interface /Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/compiler-interface/jars/compiler-interface-0.13.2-M1-sources.jar \ -scala-path /Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/javadocs/scala-compiler-2.9.3-javadoc.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/sources/scala-compiler-2.9.3-sources.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/jars/scala-library-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/sources/scala-library-2.9.3-sources.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/javadocs/scala-library-2.9.3-javadoc.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/jline/jars/jline-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.fusesource.jansi/jansi/jars/jansi-1.4.jar \ -S-encoding \ -SUTF-8 \ -S-g:vars -S-deprecation \ -S-unchecked \ -analysis-cache /Users/tdesai/projects/pants/.pants.d/scalac/analysis/artifact_cache_tmpdir/5ea3c8f4-b3bc-4811-85d8-a74d22d3e936/src.scala.com.pants.example.jvm-run-example-lib/analysis \ -classpath /Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/javadocs/scala-compiler-2.9.3-javadoc.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/sources/scala-compiler-2.9.3-sources.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/sources/scala-library-2.9.3-sources.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/jars/scala-library-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/javadocs/scala-library-2.9.3-javadoc.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/jline/jars/jline-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.fusesource.jansi/jansi/jars/jansi-1.4.jar:/Users/tdesai/projects/pants/.pants.d/scalac/resources:/Users/tdesai/projec ts/pants/.pants.d/scalac/classes \ -d /Users/tdesai/projects/pants/.pants.d/scalac/classes \ src/scala/com/pants/example/JvmRunExample.scala

Vs the one generated by pants

/Library/JAVA/Home/bin/java -Xmx2g -XX:MaxPermSize=256m \ -Dzinc.analysis.cache.limit=0 \ -cp /Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.zinc/zinc/javadocs/zinc-0.3.2-M1-javadoc.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.zinc/zinc/jars/zinc-0.3.2-M1.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.zinc/zinc/sources/zinc-0.3.2-M1-sources.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/jars/scala-library-2.10.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/incremental-compiler/jars/incremental-compiler-0.13.2-M1.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.10.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-reflect/jars/scala-reflect-2.10.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/sbt-interface/jars/sbt-interface-0.13.2-M1.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/compiler-interface /jars/compiler-interface-0.13.2-M1-sources.jar com.typesafe.zinc.Main \ -log-level debug \ -sbt-interface /Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/sbt-interface/jars/sbt-interface-0.13.2-M1.jar \ -compiler-interface /Users/tdesai/projects/pants/.pants.d/classpath/jars/com.typesafe.sbt/compiler-interface/jars/compiler-interface-0.13.2-M1-sources.jar \ -scala-path /Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/javadocs/scala-compiler-2.9.3-javadoc.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/sources/scala-compiler-2.9.3-sources.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/jars/scala-library-2.9.3-sources.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/sources/scala-library-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/javadocs/scala-library-2.9.3-javadoc.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/jline/jars/jline-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.fusesource.jansi/jansi/jars/jansi-1.4.jar \ -S-encoding \ -SUTF-8 \ -S-g:vars -S-deprecation \ -S-unchecked \ -analysis-cache /Users/tdesai/projects/pants/.pants.d/scalac/analysis/artifact_cache_tmpdir/5ea3c8f4-b3bc-4811-85d8-a74d22d3e936/src.scala.com.pants.example.jvm-run-example-lib/analysis \ -classpath /Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/javadocs/scala-compiler-2.9.3-javadoc.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-compiler/sources/scala-compiler-2.9.3-sources.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/sources/scala-library-2.9.3-sources.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/jars/scala-library-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/scala-library/javadocs/scala-library-2.9.3-javadoc.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.scala-lang/jline/jars/jline-2.9.3.jar:/Users/tdesai/projects/pants/.pants.d/classpath/jars/org.fusesource.jansi/jansi/jars/jansi-1.4.jar:/Users/tdesai/projects/pants/.pants.d/scalac/resources:/Users/tdesai/projec ts/pants/.pants.d/scalac/classes \ -d /Users/tdesai/projects/pants/.pants.d/scalac/classes \ src/scala/com/pants/example/JvmRunExample.scala

The major difference is the order of scala-library-sources and scala-library is changed in -scala-path

— Reply to this email directly or view it on GitHubhttps://github.com/pantsbuild/pants/issues/50#issuecomment-40430844 .

tejal29 commented 10 years ago

this logic should be changed:

[tw-mbp13-tdesai pants]$ git grep 'scala-path' src/python/pants/tasks/jvm_compile/scala/zinc_utils.py: ['-scala-path', ':'.join(self._compiler_classpath)]) [tw-mbp13-tdesai pants]$

Or simple change would to be not pull in scala-library with_sources.

tejal29 commented 10 years ago

I can create a patch for this to only include jars in scala-path.

benjyw commented 10 years ago

If you look in BUILD.tools you'll see that sources aren't being pulled in that way.

What I suspect is happening is that the lib getting added to the classpath for running is also being used during compilation, because we don't distinguish between types of classpath.

On Mon, Apr 14, 2014 at 4:45 PM, tejal29 notifications@github.com wrote:

I can create a patch for this to only include jars in scala-path.

— Reply to this email directly or view it on GitHubhttps://github.com/pantsbuild/pants/issues/50#issuecomment-40431280 .

tejal29 commented 10 years ago

As far as i debugged itm

When pants resolves scala-compile-2.9.3 in bootstrap_jvm_tools.py, it pulls in all the jars types. javadoc and sources for scala-library and scala-compiler.

tejal29 commented 10 years ago

I will continue debugging and update the ticket.

Thanks Tejal

benjyw commented 10 years ago

That's an ivy issue then? We're not specifying withSources() in BUILD.tools.

On Mon, Apr 14, 2014 at 5:07 PM, tejal29 notifications@github.com wrote:

As far as i debugged itm

When pants resolves scala-compile-2.9.3 in bootstrap_jvm_tools.py, it pulls in all the jars types. javadoc and sources for scala-library and scala-compiler.

— Reply to this email directly or view it on GitHubhttps://github.com/pantsbuild/pants/issues/50#issuecomment-40432610 .

tejal29 commented 10 years ago

Yeah.

The generated ivy file is

<?xml version="1.0"?>

<!--
Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
Licensed under the Apache License, Version 2.0 (see LICENSE).
-->

<!-- generated by pants! -->
<ivy-module version="2.0"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"
            xmlns:m="http://ant.apache.org/ivy/maven">

  <info organisation="internal" module="80c61d5671cc60eef16c8b32a7cb8da240d6d9bd"
    revision="latest.integration"
   />

    <configurations>
      <conf name="default"/>
     </configurations>

  <dependencies>
    <dependency org="org.scala-lang"
                name="scala-compiler"
                rev="2.9.3"

    >
      <conf name="default"/>
    </dependency>
    <dependency org="org.scala-lang"
                name="scala-library"
                rev="2.9.3"

    >
      <conf name="default"/>
    </dependency>
  </dependencies>
</ivy-module>

If you run, ivy resolve on it

[tw-172-25-145-95 pants]$ /Library/JAVA/Home/bin/java -Divy.cache.dir=/Users/tdesai/.ivy2/twitter-commons -Xmx1g -XX:MaxPermSize=256m -Dsun.io.useCanonCaches=false -cp /Users/tdesai/.ivy2/twitter-commons/org.apache.ivy/ivy/jars/ivy-2.3.0.jar org.apache.ivy.Main -settings /Users/tdesai/projects/pants/build-support/ivy/ivysettings.xml -ivy /Users/tdesai/projects/pants/.pants.d/classpath/52236a16a1695ec93afb7502b12aec3bde73673a/ivy.xml -confs default -cachepath test_resolve
:: loading settings :: file = /Users/tdesai/projects/pants/build-support/ivy/ivysettings.xml
:: resolving dependencies :: internal#80c61d5671cc60eef16c8b32a7cb8da240d6d9bd;latest.integration
    confs: [default]
    found org.scala-lang#scala-compiler;2.9.3 in remote-repos-maven2
    found org.scala-lang#scala-library;2.9.3 in remote-repos-maven2
    found org.scala-lang#jline;2.9.3 in remote-repos-maven2
    found org.fusesource.jansi#jansi;1.4 in remote-repos-maven2
:: resolution report :: resolve 169ms :: artifacts dl 14ms
    ---------------------------------------------------------------------
    |                  |            modules            ||   artifacts   |
    |       conf       | number| search|dwnlded|evicted|| number|dwnlded|
    ---------------------------------------------------------------------
    |      default     |   4   |   0   |   0   |   0   ||   8   |   0   |
    ---------------------------------------------------------------------
cachepath output to test_resolve

[tw-172-25-145-95 pants]$ cat test_resolve  | tr ":" "\n" 
/Users/tdesai/.ivy2/twitter-commons/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar
/Users/tdesai/.ivy2/twitter-commons/org.scala-lang/scala-compiler/javadocs/scala-compiler-2.9.3-javadoc.jar
/Users/tdesai/.ivy2/twitter-commons/org.scala-lang/scala-compiler/sources/scala-compiler-2.9.3-sources.jar
/Users/tdesai/.ivy2/twitter-commons/org.scala-lang/scala-library/sources/scala-library-2.9.3-sources.jar
/Users/tdesai/.ivy2/twitter-commons/org.scala-lang/scala-library/jars/scala-library-2.9.3.jar
/Users/tdesai/.ivy2/twitter-commons/org.scala-lang/scala-library/javadocs/scala-library-2.9.3-javadoc.jar
/Users/tdesai/.ivy2/twitter-commons/org.scala-lang/jline/jars/jline-2.9.3.jar
/Users/tdesai/.ivy2/twitter-commons/org.fusesource.jansi/jansi/jars/jansi-1.4.jar
[tw-172-25-145-95 pants]$ 
benjyw commented 10 years ago

Now there are at least two things I'm confused about:

1) Why is ivy pulling source jars. 2) Why does it even matter? The JVM is supposed to scan jars until it finds the required .class files. So having a sources jar on the classpath shouldn't be a problem. It should be invisible to the classloader.

On Mon, Apr 14, 2014 at 5:44 PM, tejal29 notifications@github.com wrote:

Yeah.

The generated ivy file is

<?xml version="1.0"?>

<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd" xmlns:m="http://ant.apache.org/ivy/maven">

<info organisation="internal" module="80c61d5671cc60eef16c8b32a7cb8da240d6d9bd" revision="latest.integration" />

<configurations>
  <conf name="default"/>
 </configurations>
```

If you run, ivy resolve on it

[tw-172-25-145-95 pants]$ /Library/JAVA/Home/bin/java -Divy.cache.dir=/Users/tdesai/.ivy2/twitter-commons -Xmx1g -XX:MaxPermSize=256m -Dsun.io.useCanonCaches=false -cp /Users/tdesai/.ivy2/twitter-commons/org.apache.ivy/ivy/jars/ivy-2.3.0.jar org.apache.ivy.Main -settings /Users/tdesai/projects/pants/build-support/ivy/ivysettings.xml -ivy /Users/tdesai/projects/pants/.pants.d/classpath/52236a16a1695ec93afb7502b12aec3bde73673a/ivy.xml -confs default -cachepath test_resolve :: loading settings :: file = /Users/tdesai/projects/pants/build-support/ivy/ivysettings.xml :: resolving dependencies :: internal#80c61d5671cc60eef16c8b32a7cb8da240d6d9bd;latest.integration confs: [default] found org.scala-lang#scala-compiler;2.9.3 in remote-repos-maven2 found org.scala-lang#scala-library;2.9.3 in remote-repos-maven2 found org.scala-lang#jline;2.9.3 in remote-repos-maven2 found org.fusesource.jansi#jansi;1.4 in remote-repos-maven2 :: resolution report :: resolve 169ms :: artifacts dl 14ms

|                  |            modules            ||   artifacts   |
|       conf       | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
|      default     |   4   |   0   |   0   |   0   ||   8   |   0   |
---------------------------------------------------------------------

cachepath output to test_resolve

[tw-172-25-145-95 pants]$ cat test_resolve | tr ":" "\n" /Users/tdesai/.ivy2/twitter-commons/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar /Users/tdesai/.ivy2/twitter-commons/org.scala-lang/scala-compiler/javadocs/scala-compiler-2.9.3-javadoc.jar /Users/tdesai/.ivy2/twitter-commons/org.scala-lang/scala-compiler/sources/scala-compiler-2.9.3-sources.jar /Users/tdesai/.ivy2/twitter-commons/org.scala-lang/scala-library/sources/scala-library-2.9.3-sources.jar /Users/tdesai/.ivy2/twitter-commons/org.scala-lang/scala-library/jars/scala-library-2.9.3.jar /Users/tdesai/.ivy2/twitter-commons/org.scala-lang/scala-library/javadocs/scala-library-2.9.3-javadoc.jar /Users/tdesai/.ivy2/twitter-commons/org.scala-lang/jline/jars/jline-2.9.3.jar /Users/tdesai/.ivy2/twitter-commons/org.fusesource.jansi/jansi/jars/jansi-1.4.jar [tw-172-25-145-95 pants]$

— Reply to this email directly or view it on GitHubhttps://github.com/pantsbuild/pants/issues/50#issuecomment-40434405 .

tejal29 commented 10 years ago

Comment below: Now there are at least two things I'm confused about:

1) Why is ivy pulling source jars. ( looking up on ivy manual)

2) Why does it even matter? The JVM is supposed to scan jars until it finds the required .class files. So having a sources jar on the classpath shouldn't be a problem. It should be invisible to the classloader.

-- it should not matter for JVM compile, But the way zinc compiler uses the values passed to scala-path to compure the scala-library incorrect. The reg-ex is in-correct https://github.com/typesafehub/zinc/blob/master/src/main/scala/com/typesafe/zinc/Setup.scala#L158 and https://github.com/typesafehub/zinc/blob/master/src/main/scala/com/typesafe/zinc/Setup.scala#L28 The pattern is: "scala-library(-.*)?.jar" Now, i am not a scala expert but that reg-ex passes for both scala-library-2.9.3.jar and scala-library-sources-2.9.3.jar This is the problem and that is why --scala-path point to sources jar instead of class jar.

tejal29 commented 10 years ago

So, i think there are two bugs here: 1) scala-compile-2.9.3 does not need to pull in scala-library. I checked the http://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.9.3/scala-compiler-2.9.3.pom. This pom already pulls scala-library as a a dependency. Applying this diff, fixes the issue of not having scala-library-sources.jar on the classpath.

 [tw-mbp13-tdesai pants]$ git diff
diff --git a/BUILD.tools b/BUILD.tools
@@ -48,7 +48,6 @@ jar_library(name = 'zinc',
 jar_library(name = 'scala-compile-2.9.3',
             dependencies = [
               jar(org = 'org.scala-lang', name = 'scala-compiler', rev = '2.9.3'),
-              jar(org = 'org.scala-lang', name = 'scala-library', rev = '2.9.3'),
             ])
 Run ivy_resolve on the new ivy.xml generated
[tw-172-25-145-95 pants]$ cat test_resolve  | tr ":" "\n" 
/Users/tdesai/.ivy2/twitter-commons/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar
/Users/tdesai/.ivy2/twitter-commons/org.scala-lang/scala-compiler/javadocs/scala-compiler-2.9.3-javadoc.jar
/Users/tdesai/.ivy2/twitter-commons/org.scala-lang/scala-compiler/sources/scala-compiler-2.9.3-sources.jar
/Users/tdesai/.ivy2/twitter-commons/org.scala-lang/scala-library/jars/scala-library-2.9.3.jar
/Users/tdesai/.ivy2/twitter-commons/org.scala-lang/jline/jars/jline-2.9.3.jar
/Users/tdesai/.ivy2/twitter-commons/org.fusesource.jansi/jansi/jars/jansi-1.4.jar
[tw-172-25-145-95 pants]$ 

2) We need to file a bug with zinc and pants can use --scala-compiler and --scala-library args till the bug gets fixed.

I am sending a review out for first case here https://rbcommons.com/s/twitter/r/223/

benjyw commented 10 years ago

On Mon, Apr 14, 2014 at 6:50 PM, tejal29 notifications@github.com wrote:

Comment below:

Now there are at least two things I'm confused about:

1) Why is ivy pulling source jars. ( looking up on ivy manual)

2) Why does it even matter? The JVM is supposed to scan jars until it finds the required .class files. So having a sources jar on the classpath shouldn't be a problem. It should be invisible to the classloader.

-- it should not matter for JVM compile, But the way zinc compiler uses the values passed to scala-path to compure the scala-library incorrect. The reg-ex is in-correct

https://github.com/typesafehub/zinc/blob/master/src/main/scala/com/typesafe/zinc/Setup.scala#L158and

https://github.com/typesafehub/zinc/blob/master/src/main/scala/com/typesafe/zinc/Setup.scala#L28 The pattern is: "scala-library(-.)?.jar"* Now, i am not a scala expert but that reg-ex passes for both scala-library-2.9.3.jar and scala-library-sources-2.9.3.jar This is the problem and that is why --scala-path point to sources jar instead of class jar.

Aha! Great detective work. I will send a fix to Typesafe, since I've already done a ton of hacking on Zinc.

— Reply to this email directly or view it on GitHubhttps://github.com/pantsbuild/pants/issues/50#issuecomment-40437846 .

tejal29 commented 10 years ago

Cool.. This is causing travis CI to break Here is the latest run for 2.7 https://travis-ci.org/pantsbuild/pants/jobs/23011637

https://travis-ci.org/pantsbuild/pants/jobs/23011637#L939

I am guessing, it is trying to run --version on the source jar to find the version and it fails.

lahosken commented 10 years ago

Oh yay, I pull Tejal's change this morning, and now I can run jvm-run-example. As far as I'm concerned, this issue's resolved; Scala is happy again. Though it looks like y'all are talking about a lot of stuff, so I hesitate to press the "Close" button.

tejal29 commented 10 years ago

Actually we still need to get a fix for part 1 which is why is ivy pulling in 1) Why is ivy pulling source jars.

@jsirois discovered, that not specifying mapping in pants generated ivy.xml assumes '*' or pull in all jars. Hence the source-jars and javadoc-jar get pulled in.

I verified it by adding "mapped" to the generated ivy.xml

<ivy-module version="2.0"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"
            xmlns:m="http://ant.apache.org/ivy/maven">
  <info organisation="internal" module="80c61d5671cc60eef16c8b32a7cb8da240d6d9bd"
    revision="latest.integration"
   />
   <configurations>
      <conf name="default"/>
     </configurations>
  <dependencies>
    <dependency org="org.scala-lang"
                name="scala-compiler"
                rev="2.9.3">
      <conf name="default" mapped="default"/>
   </dependency>
</dependencies>
</ivy-module>

Now i run the same above commands to resolve this and cat the classpath i only see the jars

/Library/JAVA/Home/bin/java -Divy.cache.dir=/Users/tdesai/.ivy2/twitter-commons -Xmx1g -XX:MaxPermSize=256m -Dsun.io.useCanonCaches=false -cp /Users/tdesai/.ivy2/twitter-commons/org.apache.ivy/ivy/jars/ivy-2.3.0.jar org.apache.ivy.Main -settings /Users/tdesai/projects/pants/build-support/ivy/ivysettings.xml -ivy ivy.xml  -confs default -cachepath test_resolve
tw-172-25-145-95 pants]$ cat test_resolve  | tr ":" "\n" 
/Users/tdesai/.ivy2/twitter-commons/org.scala-lang/scala-compiler/jars/scala-compiler-2.9.3.jar
/Users/tdesai/.ivy2/twitter-commons/org.scala-lang/scala-library/jars/scala-library-2.9.3.jar

@jsirois is adding a fix.

tejal29 commented 10 years ago

Fix here https://rbcommons.com/s/twitter/r/229/

https://github.com/pantsbuild/pants/pull/59