0

I'm using Spring declaring it at dependencyManagement:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>2.7.0</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

Inside org.springframework.boot:spring-boot-dependencies:2.7.0 is defined a property:

<properties>
    ...
    <lombok.version>1.18.24</lombok.version>
    ...
</properties>

Problem is I need to make use of it from my pom:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.10.1</version>
            <configuration>
                <release>${java.version}</release>
                <annotationProcessorPaths>
                    <annotationProcessorPath>
                        <groupId>org.projectlombok</groupId>
                        <artifactId>lombok</artifactId>
                        <version>${lombok.version}</version>
                    </annotationProcessorPath>
                    <annotationProcessorPath>
                        <groupId>org.mapstruct</groupId>
                        <artifactId>mapstruct-processor</artifactId>
                        <version>${org.mapstruct.version}</version>
                    </annotationProcessorPath>
                </annotationProcessorPaths>
            </configuration>
        </plugin>
    </plugins>
</build>

This property is not found:

~/projects/cultura/git/repositories/backend develop* ❯ mvn compile                                                                                                                                                                                                     14:56:41

[INFO] Scanning for projects...

[INFO] 

[INFO] ---------------------< cat.gencat.clt.git:backend >---------------------

[INFO] Building backend 0.0.1-SNAPSHOT

[INFO] --------------------------------[ jar ]---------------------------------

[INFO] 

[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ backend ---

[INFO] Using 'UTF-8' encoding to copy filtered resources.

[INFO] Copying 3 resources

[INFO] 

[INFO] --- maven-compiler-plugin:3.10.1:compile (default-compile) @ backend ---

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time:  5.092 s

[INFO] Finished at: 2022-08-23T14:56:52+02:00

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project backend: Resolution of annotationProcessorPath dependencies failed: For artifact {org.projectlombok:lombok:null:jar}: The version cannot be empty. -> [Help 1]

[ERROR] 

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR] 

[ERROR] For more information about the errors and possible solutions, please read the following articles:

Is there any way to make a reference to lombok property defined into spring bom properties?

Jordi
  • 20,868
  • 39
  • 149
  • 333
  • By using it as a parent instead of a bom. By using it as a bom you only get the dependencies, you loose everything else (properties, plugin config etc.). – M. Deinum Aug 23 '22 at 13:12
  • `I need to make use of it from my pom` - you don't. Just remove `annotationProcessorPaths` configuration and define `lombok` and `mapstruct` as dependencies with `scope`=`provided`. https://stackoverflow.com/questions/70207686/maven-requires-plugin-version-to-be-specified-for-the-managed-dependency-spring – Andrey B. Panfilov Aug 23 '22 at 23:19

0 Answers0