Skip to content

sombriks/dagger2-bld-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dagger2 bld example

Sample project on how to use bld to build a dagger2, javalin, jdbi3 and htmx project.

Base setup

Install sdkman

curl -s "https://get.sdkman.io" | bash

Use it to install bld command line tool

sdk install bld

Create the project

bld create-app example.dagger2 dagger2-bld-example Example
cd dagger2-bld-example
mkdir -p src/main/java/example/dagger2/{configs,controllers,models,services,repositories}
touch src/main/java/example/dagger2/models/{Task,State,Kanban}.java

# or code .
idea .

How to build

./bld download compile

How to test

./bld test

How to run

./bld run

Noteworthy

  • Dagger2 depends on code generation, and annotation processing must be enabled in bld build class.
  • Do not reuse regular source directory for generated classes. Instead, define in build class a custom generated source folder and add it in your IDE.
  • One key aspect when dealing with compile-time solutions like Dagger is how erros tend to be more present at compile-time than runtime. Reflection-heavy applications tends to show errors at runtime only.
  • Due to some IDE misconfiguration, annotation processing isn't regenerating the classes into the directory defined in bld build. Whenever change something in the Module or in the Component, first delete the packages under the generated folder, then recompile it with ./bld compile to get a sane classpath again.

About

Sample project on how to use bld to build a dagger2, javalin, jdbi and htmx project.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages