Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lombok dependency is exposed to consumers #768

Closed
vierbergenlars opened this issue Feb 9, 2022 · 3 comments · Fixed by #769
Closed

Lombok dependency is exposed to consumers #768

vierbergenlars opened this issue Feb 9, 2022 · 3 comments · Fixed by #769

Comments

@vierbergenlars
Copy link
Contributor

Describe the bug

Some spring-content components have a dependency on lombok that is exposed to downstream consumers.

Since lombok is only used at compile-time to generate additional code and consumers do not have to care about this dependency, it should not be exposed downstream.

To Reproduce
Steps to reproduce the behavior:

  1. Create a project with the spring-content-rest-boot-starter (but without lombok)
  2. Add a class with a lombok-annotation to it.
  3. Compile the project, notice that lombok is on the compile classpath and is unexpectedly run on my project.

Expected behavior

Lombok is not present on the compile- or runtime classpath of my application that uses spring-content.

Additional context

Snippet from the compile dependencies of my project, which depends on spring-content-rest-boot-starter
Note the indirect dependency on lombok, through the dependencies spring-content-rest-boot-starter -> spring-content-rest -> spring-content-commons -> lombok.

``` +--- com.github.paulcwarren:spring-content-rest-boot-starter -> 1.2.7 | +--- com.github.paulcwarren:spring-content-rest:1.2.7 | | +--- org.springframework:spring-webmvc:5.3.13 -> 5.3.15 (*) | | +--- javax.servlet:javax.servlet-api:4.0.1 | | +--- org.springframework.hateoas:spring-hateoas:1.4.0 -> 1.4.1 (*) | | +--- org.springframework.data:spring-data-commons:2.6.0 -> 2.6.1 (*) | | +--- org.springframework.data:spring-data-rest-core:3.6.0 -> 3.6.1 (*) | | +--- com.github.paulcwarren:spring-content-commons:1.2.7 | | | +--- org.springframework:spring-context:5.3.13 -> 5.3.15 (*) | | | +--- commons-io:commons-io:2.11.0 | | | +--- com.github.paulcwarren:spring-versions-commons:1.2.7 | | | | +--- org.springframework.security:spring-security-core:5.6.0 -> 5.6.1 | | | | | +--- org.springframework.security:spring-security-crypto:5.6.1 | | | | | +--- org.springframework:spring-aop:5.3.14 -> 5.3.15 (*) | | | | | +--- org.springframework:spring-beans:5.3.14 -> 5.3.15 (*) | | | | | +--- org.springframework:spring-context:5.3.14 -> 5.3.15 (*) | | | | | +--- org.springframework:spring-core:5.3.14 -> 5.3.15 (*) | | | | | \--- org.springframework:spring-expression:5.3.14 -> 5.3.15 (*) | | | | +--- org.springframework.data:spring-data-commons:2.6.0 -> 2.6.1 (*) | | | | +--- org.springframework:spring-tx:5.3.13 -> 5.3.15 (*) | | | | \--- ch.qos.logback:logback-classic:1.2.9 -> 1.2.10 (*) | | | +--- org.projectlombok:lombok:1.18.22 | | | \--- ch.qos.logback:logback-classic:1.2.9 -> 1.2.10 (*) | | +--- org.atteo:evo-inflector:1.3 | | +--- com.github.paulcwarren:spring-versions-commons:1.2.7 (*) | | +--- org.springframework:spring-tx:5.3.13 -> 5.3.15 (*) | | +--- org.projectlombok:lombok:1.18.22 | | \--- ch.qos.logback:logback-classic:1.2.9 -> 1.2.10 (*) | +--- com.github.paulcwarren:spring-content-autoconfigure:1.2.7 | | +--- org.springframework.boot:spring-boot-autoconfigure:2.6.1 -> 2.6.3 (*) | | \--- ch.qos.logback:logback-classic:1.2.9 -> 1.2.10 (*) | \--- ch.qos.logback:logback-classic:1.2.9 -> 1.2.10 (*) ```

I ran in to this issue because I am using Gradle for my spring-content project, where there is a separation between compile classpath and annotation-processors classpath. The lombok annotations did not result in an error during compilation because they were on the compile classpath, but the annotation processor did not run either, because lombok was not on the annotation-processor classpath.

vierbergenlars added a commit to vierbergenlars/spring-content that referenced this issue Feb 9, 2022
The lombok annotation processor should be placed in the provided scope,
so its dependency is not propagated to projects that depend on
spring-content.

Fixes paulcwarren#768
vierbergenlars added a commit to vierbergenlars/spring-content that referenced this issue Feb 9, 2022
The lombok annotation processor should be placed in the provided scope,
so its dependency is not propagated to projects that depend on
spring-content.

For projects where lombok is only used in tests, it is placed in the
test scope.

Fixes paulcwarren#768
@paulcwarren
Copy link
Owner

paulcwarren commented Feb 10, 2022

Thanks @vierbergenlarsm, ah thanks. I think this was an oversight on my part. I believe the dependency should be at provided scope for maven. I'll look into it.

@vierbergenlars
Copy link
Contributor Author

I have already provided a PR (#769) that puts lombok in the provided scope and adds the dependency to the tests where it was previously transitively included.

In some places, lombok is used for the main sources too, so there it is placed in the provided scope.

@paulcwarren
Copy link
Owner

Thanks Lars

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants