Git Product home page Git Product logo

Comments (15)

dacr avatar dacr commented on July 17, 2024

Looks like the dependency comes from scala-compiler/ivy-2.11.0-M8.xml :

       <dependencies>
                <dependency org="org.scala-lang" name="scala-library" rev="2.11.0-M8" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
                <dependency org="org.scala-lang" name="scala-reflect" rev="2.11.0-M8" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
                <dependency org="org.scala-lang.modules" name="scala-xml_2.11.0-M8" rev="1.0.0-RC7" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
                <dependency org="org.scala-lang.modules" name="scala-parser-combinators_2.11.0-M8" rev="1.0.0-RC5" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
                <dependency org="jline" name="jline" rev="2.11" force="true" conf="optional->compile(*),master(*)"/>
        </dependencies>

from scala-xml.

jsuereth avatar jsuereth commented on July 17, 2024

@adriaanm This is related to the other thread about running scaladoc, it seems but worse. I'll see if I can dive into your classpaths and try to restore some sanity.

from scala-xml.

jsuereth avatar jsuereth commented on July 17, 2024

Proof of the issue, as well as culprit:

> show test:fullClasspath
[warn] Credentials file /home/jsuereth/.ivy2/.credentials does not exist
[info] List(Attributed(/home/jsuereth/projects/scala/scala-xml/target/scala-2.11.0-M8/test-classes), Attributed(/home/jsuereth/projects/scala/scala-xml/target/scala-2.11.0-M8/classes), Attributed(/home/jsuereth/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.0-M8.jar), Attributed(/home/jsuereth/.ivy2/cache/org.scala-lang/scala-compiler/jars/scala-compiler-2.11.0-M8.jar), Attributed(/home/jsuereth/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.11.0-M8.jar), Attributed(/home/jsuereth/.ivy2/cache/org.scala-lang.modules/scala-xml_2.11.0-M8/bundles/scala-xml_2.11.0-M8-1.0.0-RC7.jar), Attributed(/home/jsuereth/.ivy2/cache/org.scala-lang.modules/scala-parser-combinators_2.11.0-M8/bundles/scala-parser-combinators_2.11.0-M8-1.0.0-RC5.jar), Attributed(/home/jsuereth/.ivy2/cache/junit/junit/jars/junit-4.11.jar), Attributed(/home/jsuereth/.ivy2/cache/org.hamcrest/hamcrest-core/jars/hamcrest-core-1.3.jar), Attributed(/home/jsuereth/.ivy2/cache/com.novocode/junit-interface/jars/junit-interface-0.10.jar), Attributed(/home/jsuereth/.ivy2/cache/junit/junit-dep/jars/junit-dep-4.10.jar), Attributed(/home/jsuereth/.ivy2/cache/org.scala-tools.testing/test-interface/jars/test-interface-0.5.jar))
[success] Total time: 0 s, completed Feb 28, 2014 9:03:29 AM
> libraryDependencies
[info] List(org.scala-lang:scala-library:2.11.0-M8, junit:junit:4.11:test, com.novocode:junit-interface:0.10:test, org.scala-lang:scala-compiler:2.11.0-M8:test)

from scala-xml.

jsuereth avatar jsuereth commented on July 17, 2024

Ok, this fix is simple. In build.sbt:

// used in CompilerErrors test
libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").excludeAll(ExclusionRule(organization="org.scala-lang.modules"))

Proof:

show test:fullClasspath
[warn] Credentials file /home/jsuereth/.ivy2/.credentials does not exist
[info] Updating {file:/home/jsuereth/projects/scala/scala-xml/}scala-xml...
[info] Resolving jline#jline;2.11 ...
[info] Done updating.
[info] List(Attributed(/home/jsuereth/projects/scala/scala-xml/target/scala-2.11.0-M8/test-classes), Attributed(/home/jsuereth/projects/scala/scala-xml/target/scala-2.11.0-M8/classes), Attributed(/home/jsuereth/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.0-M8.jar), Attributed(/home/jsuereth/.ivy2/cache/org.scala-lang/scala-compiler/jars/scala-compiler-2.11.0-M8.jar), Attributed(/home/jsuereth/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.11.0-M8.jar), Attributed(/home/jsuereth/.ivy2/cache/junit/junit/jars/junit-4.11.jar), Attributed(/home/jsuereth/.ivy2/cache/org.hamcrest/hamcrest-core/jars/hamcrest-core-1.3.jar), Attributed(/home/jsuereth/.ivy2/cache/com.novocode/junit-interface/jars/junit-interface-0.10.jar), Attributed(/home/jsuereth/.ivy2/cache/junit/junit-dep/jars/junit-dep-4.10.jar), Attributed(/home/jsuereth/.ivy2/cache/org.scala-tools.testing/test-interface/jars/test-interface-0.5.jar))

Locally tests seem to pass. @adriaanm if you want to go this route, I can submit a PR. I think it's what you want, but please validate the resulting classpath.

from scala-xml.

dacr avatar dacr commented on July 17, 2024

NOK - Just tested on my environment with a modified XMLEventReader source code. I got the same proof result as you for "show test:fullClasspath" sbt command, but the reality is different, when sbt is started with -verbose JVMOptions, I can still see this class loaded from file scala- xml_2.11.0-M8-1.0.0-RC7.jar and not from scala-xml-dacr/target/scala-2.11.0-M8/classes.

[Loaded scala.xml.pull.XMLEventReader from file:/home/work/.ivy2/cache/org.scala-lang.modules/scala-xml_2.11.0-M8/bundles/scala-xml_2.11.0-M8-1.0.0-RC7.jar]

and so my test case is not executed against my modified XMLEventReader class.

from scala-xml.

adriaanm avatar adriaanm commented on July 17, 2024

Ok, thanks for raising this! I consider this a blocker for the Scala 2.11.0 final release.

from scala-xml.

adriaanm avatar adriaanm commented on July 17, 2024

Implied: I'm looking into fixing this and putting in a backstop to make sure we don't break this again. Help much appreciated!

from scala-xml.

jsuereth avatar jsuereth commented on July 17, 2024

Ok, working build fix: https://github.com/scala/scala-xml/tree/wip/fix-build-classpath (not in my own fork, sorry!)

from scala-xml.

dacr avatar dacr commented on July 17, 2024

I've cloned your branch :
1/ no changes, tests are OK although I can see that :

$ export SBT_OPTS="-verbose" ; sbt test | grep "XMLEventReader "
[Loaded scala.xml.pull.XMLEventReader from file:/Users/dcr/.ivy2/cache/org.scala-lang.modules/scala-xml_2.11.0-M8/bundles/scala-xml_2.11.0-M8-1.0.0-RC7.jar]

(vi ~/.sbtconfig to remove SBT_OPTS overwrite)

2/ bring back my XMLEventReader and XMLEventReaderTest changes, but the dependency is still here, and the wrong XMLEventReader class is tested.

from scala-xml.

adriaanm avatar adriaanm commented on July 17, 2024

I haven't pushed the second half of my fix (developed with help of @jsuereth):

//// testing:
// used in CompilerErrors test
libraryDependencies += ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "test").exclude("org.scala-lang.modules", s"scala-xml*")

// needed to fix classloader issues (see #20)
// alternatively, manage the scala instance as shown below (commented)
fork in Test := true

from scala-xml.

jsuereth avatar jsuereth commented on July 17, 2024

Yeah, I still haven't found where scala-xml 2.11.0-M8 is sneaking into the classpath. My guess is it's getting loaded in sbt's Dual-Loader when the scala compiler is run against the code and then when our child classloader (for the project) is used, it gets that parent one.

Two follow ups:

  1. We may want to separate sbt from any attempts to share Scala classloaders between the compiler + the project. What we're doing now breaks scala modularization.
  2. We should resolve the scala-tool configuration for scala modules using "dummy" artifacts so that when there are circular dependencies the current project doesn't get in the way of grabbing necessary jars for bootstrapping.

from scala-xml.

dacr avatar dacr commented on July 17, 2024

ok sorry I thought it was done. And thanks for the work around, (fork in Test := true).

from scala-xml.

gourlaysama avatar gourlaysama commented on July 17, 2024

It seems like this is also happening with scala-parser-combinators. After desperately trying to make a new test pass, I realized the wrong classfiles were tested... see scala/scala-parser-combinators#13.

from scala-xml.

drewboardman avatar drewboardman commented on July 17, 2024

I'm still running into this bug.

from scala-xml.

SethTisue avatar SethTisue commented on July 17, 2024

@drewboardman can you be more specific?

there are a lot of tickets in this area; I made a (probably not complete) list at #195 (comment)

you are using sbt 1.1.2 or newer, I hope?

from scala-xml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.