scalastyle / scalastyle-sbt-plugin

scalastyle-sbt-plugin
Apache License 2.0
139 stars 52 forks source link

scalastyle-sbt-plugin 0.4.0 is messing up other plugins classpath #15

Closed sslavic closed 10 years ago

sslavic commented 10 years ago

I'm trying to use scrooge-sbt-plugin (3.12.3, still not released) and scalastyle-sbt-plugin (0.4.0) in same project. As soon as scalastyle-sbt-plugin is just added to plugins.sbt, build starts crashing, scrooge-sbt-plugin execution fails with:

Caused by: java.lang.ClassNotFoundException: scopt.mutable.OptionParser
        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)
        at com.twitter.scrooge.ScroogeSBT$.compile(ScroogeSBT.scala:24)
        at com.twitter.scrooge.ScroogeSBT$$anonfun$16.apply(ScroogeSBT.scala:204)
        at com.twitter.scrooge.ScroogeSBT$$anonfun$16.apply(ScroogeSBT.scala:200)
        at scala.Function7$$anonfun$tupled$1.apply(Function7.scala:35)
        at scala.Function7$$anonfun$tupled$1.apply(Function7.scala:34)
        at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
        at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
        at sbt.std.Transform$$anon$4.work(System.scala:64)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
        at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
        at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
        at sbt.Execute.work(Execute.scala:244)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
        at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
        at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
        at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:744)
[error] (bar/compile:scroogeGen) java.lang.NoClassDefFoundError: scopt/mutable/OptionParser
matthewfarwell commented 10 years ago

Yes, we use version 3.2.0 of scopt and they use 2.1.0. We upgraded as part of 0.4.0. I'll have to have a think about the best way to sort this out. Ping me in a week or so if I haven't responded.

sslavic commented 10 years ago

Sounds like design issue in sbt itself, if all plugins share classpath, and thus cannot use different versions of a dependency.

matthewfarwell commented 10 years ago

I've removed the dependency on scopt, see commit https://github.com/scalastyle/scalastyle/commit/cecc7091f025b5ba977a718406f3f2dd5c2c4b49 Can you check if the latest build of the sbt plugin and see if you still have the problem. Thanks.

elipoz commented 10 years ago

When the next public release (0.5.0) will be available?

matthewfarwell commented 10 years ago

This should have been fixed by 0.5.0. Closing this issue