Use of Gradle annotationProcessor dependency scope in Maven?

Viewed 300

Recently I was messing around with VSCode and configuring it to work with Java and Spring framework and I found this official guide for setup.

The curious thing that I'd like to share and ask about is in "Edit the project" section which contains a video on how to add dependencies. And it shows us that you can add maven dependency with annotationProcessor scope!

enter image description here

From official Maven doc we know Maven defines 6 scopes: compile, runtime, provided, system, test, and import. And what I found more is that anotationProcessor is a dependency configuration that could be applied in Gradle.

So I tried to do the same in my IntelliJ IDEA project:

<dependency>
   <groupId>org.projectlombok</groupId>
   <artifactId>lombok</artifactId>
   <version>${projectlombok.version}</version>
   <scope>annotationProcessor</scope>
</dependency>

enter image description here

and it worked! - it compiles!

So my question, I suppose, does anybody have any explanation for that?

Thanks!

1 Answers

The scope annotationsProcessor is not a valid Maven scope.

If this works and compiles, Maven probably doesn't check thoroughly enough for scopes and maybe treads this as no scope at all (i.e. compile scope).

Related