Open regisd opened 7 years ago
I can try to fix that if you want.
It works fine for a java_binary, so what would the "fix" be?
On Tue, Dec 13, 2016 at 6:01 PM, Régis Décamps notifications@github.com wrote:
I can try to fix that if you want.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bazelbuild/rules_appengine/issues/33#issuecomment-266889999, or mute the thread https://github.com/notifications/unsubscribe-auth/ALF-0tgLhu16wbPtkuNJiKLLNGaeRWmwks5rHyPYgaJpZM4LMVPL .
I don't experience the same behaviour. The provided examples
uses a java_binary
and this is also failing when referencing the target rather than the jar.
I mean, the compilation works doesn't succeeds, but the war doesn't contain the jar, hence the server will hit a NoClassDefFoundError
at runtime.
And this is how I would fix it:
--- a/appengine/appengine.bzl
+++ b/appengine/appengine.bzl
@@ -121,6 +121,9 @@ def _war_impl(ctxt):
transitive_deps = set()
for jar in ctxt.attr.jars:
if hasattr(jar, "java"): # java_library, java_import
+ transitive_deps += jar.files
transitive_deps += jar.java.transitive_runtime_deps
elif hasattr(jar, "files"): # a jar file
transitive_deps += jar.files
Are you using the '_deploy.jar' target of the java_binary?
On Tue, Dec 13, 2016 at 6:13 PM, Régis Décamps notifications@github.com wrote:
And this is how I would fix it:
--- a/appengine/appengine.bzl +++ b/appengine/appengine.bzl @@ -121,6 +121,9 @@ def _war_impl(ctxt):
transitive_deps = set() for jar in ctxt.attr.jars: if hasattr(jar, "java"): # java_library, java_import+ transitive_deps += jar.files transitive_deps += jar.java.transitive_runtime_deps elif hasattr(jar, "files"): # a jar file transitive_deps += jar.files
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bazelbuild/rules_appengine/issues/33#issuecomment-266892386, or mute the thread https://github.com/notifications/unsubscribe-auth/ALF-0gK1gomklY4wWAHORVMYcEgfvsa1ks5rHyaHgaJpZM4LMVPL .
Paul, can you open the description on github? I involuntary pressed send, but edited the issue with more details.
To answer your last question, I was expecting to use
jars = ["//examples/src"],
I see.
No, you have to use //examples/src:src_deploy.jar to get all of the transitive deps in jar form.
So maybe as you point out, the doc should be updated. Not sure the suggested .bzl change is sufficient for a java_library
The doc reads:
and
In my experience, the jars from the targets are not added.
In fact, even
examples
is adding the jar explicitely:This would also work:
But this doesn't:
If I understand correctly, it should (and the syntax would be nicer and follow the convention of listing targets, not build artifacts).