New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`provided` dependencies not on `run` classpath #3733

Open
ryan-williams opened this Issue Nov 13, 2017 · 4 comments

Comments

Projects
None yet
4 participants
@ryan-williams

ryan-williams commented Nov 13, 2017

(See the guidelines for contributing, linked above)

steps

Repro repo

Setup:

git clone git@github.com:ryan-williams/scala-bugs.git
cd scala-bugs
git checkout provided

Tests get provided dependencies on the classpath:

sbt test  # runs fine

as does console:

sbt console
scala> new org.apache.spark.SparkConf  // works fine

but run does not:

sbt run
…
[error] (run-main-0) java.lang.NoClassDefFoundError: org/apache/spark/SparkConf
[error] java.lang.NoClassDefFoundError: org/apache/spark/SparkConf
[error] 	at Main$.main(Main.scala:5)
[error] 	at Main.main(Main.scala)
[error] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
…

Files

build.sbt:

scalaVersion := "2.11.11"
libraryDependencies ++= Seq(
  "org.apache.spark" %% "spark-core" % "2.2.0" % "provided",
  "org.scalatest" %% "scalatest" % "3.0.0" % "test"
)

src/main/scala/Main.scala:

object Main {
  def main(args: Array[String]): Unit = {
    println(new org.apache.spark.SparkConf())
  }
}

src/test/scala/Test.scala:

class Test extends org.scalatest.FunSuite {
  test("test") {
    println(new org.apache.spark.SparkConf())
  }
}

problem

sbt run crashes

expectation

sbt run should get provided dependencies on the classpath

notes

also discussed in this SO

sbt version: 1.0.3

@ravwojdyla

This comment has been minimized.

Show comment
Hide comment
@ravwojdyla

ravwojdyla commented Dec 21, 2017

PTAL: sbt/zinc#473

@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Dec 22, 2017

Member

Zinc fix is now merged. Please try sbt 1.1.0-RC3.

Member

eed3si9n commented Dec 22, 2017

Zinc fix is now merged. Please try sbt 1.1.0-RC3.

@eed3si9n eed3si9n closed this Dec 22, 2017

@eed3si9n eed3si9n added this to the 1.1.0 milestone Dec 22, 2017

@mhamilton723

This comment has been minimized.

Show comment
Hide comment
@mhamilton723

mhamilton723 Mar 7, 2018

@eed3si9n This is still affecting my build with 1.1.0. Are you sure it is fixed?

mhamilton723 commented Mar 7, 2018

@eed3si9n This is still affecting my build with 1.1.0. Are you sure it is fixed?

@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Mar 7, 2018

Member

@mhamilton723 Thanks for letting us know. I can confirm that this is still an issue.

Member

eed3si9n commented Mar 7, 2018

@mhamilton723 Thanks for letting us know. I can confirm that this is still an issue.

@eed3si9n eed3si9n reopened this Mar 7, 2018

@eed3si9n eed3si9n modified the milestones: 1.1.0, 1.something Mar 7, 2018

@eed3si9n eed3si9n added the x/waffle label Sep 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment