mill icon indicating copy to clipboard operation
mill copied to clipboard

Spring boot: Example with spring-boot-configuration-processor

Open vaslabs opened this issue 1 month ago • 4 comments

I think it's a good example to have in mill due to the annotation processor

and that should also test the IDE navigation of Mill & BSP

vaslabs avatar Nov 11 '25 14:11 vaslabs

This works OOTB but with a warning if we just place the dependencies in

[36] [info] compiling 2 Java sources to /home/vnicolaou/mill/example/javalib/springboot/5-configuration-processor/out/compile.dest/classes ...
[36] [info] Annotation processing is enabled because one or more processors were found
[36] [info]   on the class path. A future release of javac may disable annotation processing
[36] [info]   unless at least one processor is specified by name (-processor), or a search
[36] [info]   path is specified (--processor-path, --processor-module-path), or annotation
[36] [info]   processing is enabled explicitly (-proc:only, -proc:full).
[36] [info]   Use -Xlint:-options to suppress this message.
[36] [info]   Use -proc:none to disable annotation processing.
[36] [info] done compiling
[36/36] ============================== compile ============================== 4s
Image Image

vaslabs avatar Nov 12 '25 09:11 vaslabs

@lihaoyi @lefou would it be a good idea to add an annotations processor task in Java modules to make this easier? This will make the setup for spring boot, micronaut and the likes easier than doing this ceremony, which is a bit error prone if the setup involves a bom.

I think we can have a task like annotationProcessorMvnDeps that does what the examples do + the bom which is available since this and feeds the javacOptions task

If we go with the direction of having a new task, we'd of course need to deal with backwards compatibility, so perhaps some flag or a trait that mixes in these new tasks and javac options

vaslabs avatar Nov 12 '25 10:11 vaslabs

I think we want that. But I wouldn't introduce a new trait. Can you explain, where you see the backward compatibility issues? Adding a new task should not be an issue, as long as we provide a default, which should be the empty seq. This is what we want anyways, to be able to stack traits and call super.

lefou avatar Nov 12 '25 10:11 lefou

I think we want that. But I wouldn't introduce a new trait. Can you explain, where you see the backward compatibility issues? Adding a new task should not be an issue, as long as we provide a default, which should be the empty seq. This is what we want anyways, to be able to stack traits and call super.

Ah you are right, I was thinking if it is set, it will break any examples, but yeah it will be empty. Ok then, I'll create a PR for it

vaslabs avatar Nov 12 '25 10:11 vaslabs