Skip to content
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

consider publishing a "fat-jar" #200

Closed
softprops opened this issue May 8, 2017 · 6 comments
Closed

consider publishing a "fat-jar" #200

softprops opened this issue May 8, 2017 · 6 comments

Comments

@softprops
Copy link

I'm having trouble useing this plugin in the context of bazel mostly because if its dependency on scala.xml and the interesting behavior that scala 2.11's bootclasspath

bazelbuild/rules_scala#184

I think one thing that may potentially help alleviate some of that pain would be to publish a version of this plugin in a jar that includes scala.xml as a fat jar.

@gslowikowski
Copy link
Member

scala-xml is Scala compiler's dependency. Scoverage does not add it, just uses it. You have to have some problems with compiler classpath/classloaders.

I've read bazelbuild/rules_scala#184 discussions. You must be doing something wrong. Scoverage works with three different build tools: SBT, Maven and Gradle without problems, especially I never heard about scala-xml problem.

I could help you, but I don't know Bazel at all. Could you show me in your code, how you construct scalac classpath?

@gslowikowski
Copy link
Member

Actually scalac-scoverage-plugin declares scala-xml dependency, but only because it's two-in-one component: scalac compiler plugin and reporter. When used as scalac compiler, all its dependencies are ignored. When user as reporting artifact - they are used.

@softprops
Copy link
Author

Yea it's a pretty mysterious problem for me.

What I did learn is that there is a version of scala-xml on scalacs bootclasspath on 2.11 that may be in conflict. My understanding is it's there because of some older dependency on it fir scaladoc. I confirmed I had the scala xml module on my classpath. Scalac seems to not resolve it because of the bootclasspath situation for scalac plugins with transitive dependencies.

For what it's worth I was able to get it creating the measurements and instrumentation xml file by cloning your repo and generating a fatjar with assembly sbt. We may be able create that artifact in bazel itself in the scala plugin as a "deploy jar"

I can get you the stack trace that triggered the xml classnotfound. It was a call to Serialize I believe.

@gslowikowski
Copy link
Member

I would not recommend fat jar solution.
Which Scala versions are you supporting? In Scala 2.10.x scala.xm.* classes are inside scala-library jar so if you add scala.xml.* classes to your fat jar you will have two versions of the same classes in the classpath during compilation. Very bad.

@softprops
Copy link
Author

Atm the bazel scala rules only suppprt 2.11

@softprops
Copy link
Author

I worked around this inside bazel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants