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
Error utilizing dependencies with scalac_plugin #4594
Comments
Thanks for the report! It sounds like the dependencies of the plugin are not being included on the classpath when it is used as a plugin. The reason |
Yeah, work around means less urgent for me to get the fix. Getting through a couple things I've been meaning to try and repro before I completely miss the boat on 1.3.0. |
Since this is not a regression, but a missing bit in a new feature, I'm going to drop it from the |
thoughts on tagging this to the 1.3.1 milestone now that 1.3.0 is done? thanks. |
Yep. |
Sure can give a whirl. What turn around timeline are you looking for? Caveat emptor, I don't do much python, so might not be the quickest turn around. |
Doing some inbox cleaning and found this, so checking in on status. Still an issue? |
@benjyw : AFAIK, yes. |
So far I've determined that generally the dependencies of a plugin are on the classpath when it's used as a plugin. Just not when the plugin is scala and the dep is java. Still figuring out why. |
Huh. The Java classes are on the classpath when the error occurs, so something else is going on. |
OK, so the zinc command lines in the java_sources case vs. the dependencies case are identical, except that the java_sources case has the java classes in the same /classes dir as the scala classes, and does not have the java /classes dir on the classpath. The dependencies case has those two in separate dirs, but both are on the classpath. |
Hmm, so this has nothing to do with the dep being Java. It reproduces even with a Scala dep. Oddly enough, the java_sources workaround still works when the "java sources" are actually a scala_library with .scala sources... So it boils down to zinc not loading plugin deps from outside the main plugin class's classpath element. |
Sure enough, this is a limitation of scalac: https://groups.google.com/forum/#!topic/sbt-dev/ztKxUpxM5pE |
The solution is to modify ZincCompile to add the dependency classpath elements to the My experiments show that scalac will load the plugin from the first element (and not from any subsequent elements, if they happen to also be plugins, which is good) but will load deps from any element. |
Addressed in #4987 |
awesome. thanks for sorting through this. |
Tried 1.3.0.dev13 (first release I see allowing this syntax) and 1.3.0rc1 (and a few more in between):
Repro
Have all these in the same directory:
pants.ini
:BUILD
:MyClass.scala
:MyJavaEnum.java
:MyPlugin.scala
:If you run
./pants compile ::
and you'll get:If I change the
BUILD
file to usejava_sources
instead ofdependencies
, then everything is hunky dory.Also FYI in case it matters, for my actual error vs. the repro above, I get a slightly different error:
java.lang.NoClassDefFoundError: foo/MyJavaEnum
. If you think it's worth it, I can try and improve the repro to get that error, but the work around is the same for both the simplified repro and my actual use case.The text was updated successfully, but these errors were encountered: