Issue
I'm trying setting up mapstruct with my project, I'm used to lombok that does it via a simple jvm agent so I really can't understand how to make mapstruct work.
Here's my pom:
<properties>
<m2e.apt.activation>jdt_apt</m2e.apt.activation>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<annotationProcessorPaths>
<path>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<version>${springboot.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${springboot.version}</version>
</plugin>
</plugins>
</build>
Please mind that, before mapstruct entered the game, I didn't need this whole maven compile plugin block: everything was working fine. I could build my springboot fat jar with no problems at all, no need to explicitely specify spring and lombok annotation processing...they were very good times.
Now I'm not even sure that I didn't introduce some regressions with the above code but, anyhow, I noticed that mapstruct classes are only generated when I do "mvn package". I would have expected, like for lombok, for them to be generated automatically each time I saved an object but this does not happen.
Do you have any idea? And can you assure me that that specific build block does not change anything in my spring boot project?
Solution
<!-- https://mvnrepository.com/artifact/org.mapstruct/mapstruct-processor -->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>1.5.5.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mapstruct/mapstruct -->
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>1.5.5.Final</version>
</dependency>
these two dependencies are working perfectly fine for me !
Answered By - roudlek
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.