question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generated Dagger components not found when referenced from a different Bazel rule

See original GitHub issue

I’m having trouble using Bazel and with dagger.

git clone git@github.com:jschaf/bazel-dagger-example.git
cd bazel-dagger-example
bazel build //java/coffee
$ blaze build java/coffee
INFO: Analysed target //java/coffee:coffee (0 packages loaded).
INFO: Found 1 target...
ERROR: /home/jschaf/bazels/bazel-dagger-example/java/coffee/BUILD:11:1: Building java/coffee/libcoffee_lib.jar (2 source files) and running annotation processors (ComponentProcessor) failed (Exit 1)
bazel-out/k8-fastbuild/bin/java/coffee/_javac/coffee_lib/libcoffee_lib_sourcegenfiles/coffee/DaggerCoffeeApp_Coffee.java:4: error: cannot find symbol
import coffee.dripcoffee.DripCoffeeModule_ProvideHeaterFactory;
                        ^
  symbol:   class DripCoffeeModule_ProvideHeaterFactory
  location: package coffee.dripcoffee
bazel-out/k8-fastbuild/bin/java/coffee/_javac/coffee_lib/libcoffee_lib_sourcegenfiles/coffee/DaggerCoffeeApp_Coffee.java:6: error: cannot find symbol
import coffee.dripcoffee.PumpModule_ProvidePumpFactory;
                        ^
  symbol:   class PumpModule_ProvidePumpFactory
  location: package coffee.dripcoffee

If I move everything under 1 Bazel rule, everything works.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
ronshapirocommented, Jan 16, 2018

See #871, with a fix forthcoming.

0reactions
ronshapirocommented, Jan 17, 2018

The problem using http_archive is that you need to re-define all external repositories defined by the dagger WORKSPACE file with matching names. I’ve found it easier to use new_http_archive with my own BUILD rule for each repo so that I can control the external deps.

That’s pretty much the MO of bazel, but do as you choose.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dagger 2 component not generated - Stack Overflow
classModule(new ModuleClass()).build();. it can not find DaggerCompClassComponent. I have on module build.gradle apply plugin: 'com.neenbedankt.
Read more >
bazel and dagger: problem finding generated sources
I've been able to use other code generating plugins (Google auto value and protocol buffers) with bazel but I'm having trouble with dagger....
Read more >
Dependency injection with Dagger and Bazel - ncona.com
The code generated by Dagger and the stack traces shown when something is not working are a lot easier to follow. Dagger and...
Read more >
Recently working on a project and followed modularization wi
not api, and this module has Dagger components. Problem starts when dagger kicks in, whe dagger builds the graph it generated all the...
Read more >
Automated migration of your projects to Bazel build system ...
Generating code for custom rules and macros. If you want to use the DSL for rules or macros that are not present in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found