Giter Club home page Giter Club logo

Comments (7)

mpeltonen avatar mpeltonen commented on August 22, 2024

Ah, this might be a special case related to #50, when you have the same dependency as compile and transitive test dependency. Thanks for reporting!

from sbt-idea.

mpeltonen avatar mpeltonen commented on August 22, 2024

Just to make sure, is this actually a problem in Idea? I.e. the test-scoped dependency is not seen by the non-test classes of User project in Idea?

from sbt-idea.

mpeltonen avatar mpeltonen commented on August 22, 2024

I think this shouldn't be an issue(?). I just tested in idea, and "Test" scope does not prevent a dependency from not being seen by production code in dependent project. Only if I removed "Exported" -flag, then the dependent module did not compile. Or am I missing something?

from sbt-idea.

rjmac avatar rjmac commented on August 22, 2024

They are seen in the IDE itself, but not while running. So for example, if this is in user/src/main/scala/Main.scala:

object Main {
  val log = org.slf4j.LoggerFactory.getLogger(getClass)

  def main(args: Array[String]) {
    log.info("Hello world")
  }
}

then there are no red squigglies, and SBT compiles it too of course, but when it comes time to run:

/usr/lib/jvm/java-6-openjdk/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:38881,suspend=y,server=n -javaagent:/home/robertm/idea-IC-103.255/plugins/Groovy/lib/agent/gragent.jar -Dfile.encoding=UTF-8 -classpath /usr/lib/jvm/java-6-openjdk/jre/lib/charsets.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/rhino.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/rt.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/jsse.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/jce.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/management-agent.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/resources.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/javazic.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/compilefontconfig.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/about.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/ext/pulse-java.jar:/usr/lib/jvm/java-6-openjdk/jre/lib/ext/dnsns.jar:/usr/share/java/gnome-java-bridge.jar:/home/robertm/simple/user/target/scala_2.8.1/classes:/home/robertm/simple/project/boot/scala-2.8.1/lib/scala-compiler.jar:/home/robertm/simple/project/boot/scala-2.8.1/lib/scala-library.jar:/home/robertm/simple/library/target/scala_2.8.1/classes:/home/robertm/idea-IC-103.255/lib/idea_rt.jar Main
Connected to the target VM, address: '127.0.0.1:38881', transport: 'socket'
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
    at Main$.<init>(Main.scala:10)
    at Main$.<clinit>(Main.scala)
    at Main.main(Main.scala)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
    ... 3 more
Disconnected from the target VM, address: '127.0.0.1:38881', transport: 'socket'

Process finished with exit code 1

Comment out the dependency in the Library project, reload/update/idea, and it runs fine.

from sbt-idea.

mpeltonen avatar mpeltonen commented on August 22, 2024

Ok, so the scope affects runtime classpath, like it obviously should. Good enough reason to fix it :) Thanks!

from sbt-idea.

mpeltonen avatar mpeltonen commented on August 22, 2024

Could you test 0.5.0-SNAPSHOT, if it fixes the issue for you?

from sbt-idea.

rjmac avatar rjmac commented on August 22, 2024

I can, and it did. Thanks!

from sbt-idea.

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.