[Oxygen] Eclipse Scout/ Spring Boot - MapStruct and Lombok and Maven [message #1784160] |
Fri, 23 March 2018 01:15  |
Eclipse User |
|
|
|
Hello there,
I'm playing around a lot with the combination Eclipse Scout and Spring Boot recently.
And I must admit developing business apps wasn't so much fun till these two frameworks came together.
Since I'm trying to avoid as much boilerplate code as possible I also use Lombok and MapStruct.
From within Eclipse everything works fine. The code for my Lombok classes (thanks to the integrated Lombok agent) and and the *Impl classes for MapStruct interfaces is generated on the fly and everything is up and running. There aren't any problems and it works flawlessly.
But when it comes to building the source code on the command line with maven these two guys don't work anymore. In order to find out what could possibly go wrong I tracked the problem down by first generating a simple Java Maven project and then a plain Spring Boot project.
I did exactly as it was described in the respective documentation and just added the dependencies as mentioned. Lo and behold, everything works as expected. The code is generated with maven on the command line and my classes are extended with getter/setter by Lombok and MapStruct pre-processor kicks in and the corresponding *Impl classes are generated.
Now I assume that some dependencies (perhaps certain versions) along the dependency tree within the ScoutBoot setup prevent those two from working.
Unfortunately I have no clue how to find out, which dependency this might be. I'm searching around, but with no luck.
Is there anybody out there, who might have a clue and might be able to help. Right now I'm a little bit frustrated that I can't get the maven build to work on the command line.
Any help is deeply appreciated.
Thanks, Peter
|
|
|
|
|
|
|
|
Re: [Oxygen] Eclipse Scout/ Spring Boot - MapStruct and Lombok and Maven [message #1786415 is a reply to message #1786411] |
Thu, 03 May 2018 00:58  |
Eclipse User |
|
|
|
Hi,
gaige shen wrote on Thu, 03 May 2018 00:42@Peter Pfeifer Is it works?
Yes it does.
My pom.xml for MapStruct looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>at.bfzgruenbach.shop</groupId>
<artifactId>shop</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../bfz.shop</relativePath>
</parent>
<groupId>at.bfz-gruenbach.shop.standalone</groupId>
<artifactId>standalone</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>at.bfzgruenbach.shop.commons</groupId>
<artifactId>dbmodel</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>at.bfzgruenbach.shop.commons</groupId>
<artifactId>dto</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>at.bfzgruenbach.shop.commons</groupId>
<artifactId>ui</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-jdk8</artifactId>
<version>${org.mapstruct.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/js</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<excludeDevtools>true</excludeDevtools>
<excludeArtifactIds>scout-boot-ui-dev</excludeArtifactIds>
</configuration>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<configuration>
<images>
<image>
<name>at.bfz-gruenbach.shop.bfz.standalone:${project.version}</name>
<alias>bfz.standalone</alias>
<build>
<dockerFileDir>${project.basedir}</dockerFileDir>
</build>
</image>
</images>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration combine.self="override">
<source>1.8</source>
<target>1.8</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${org.mapstruct.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
<name>bfz.standalone</name>
</project>
And for a project where I use Lombok the pom.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>dbmodel</artifactId>
<packaging>jar</packaging>
<name>bfz.dbmodel</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>at.bfzgruenbach.shop.commons</groupId>
<artifactId>commons</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../bfz.commons</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>1.5.8.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>1.5.8.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>at.bfzgruenbach.shop.commons</groupId>
<artifactId>dto</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<!-- lombok dependencies should not end up on classpath -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${org.projectlombok.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration combine.self="override">
<source>1.8</source>
<target>1.8</target>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${org.projectlombok.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
</project>
Hope this helps.
Peter
|
|
|
Powered by
FUDForum. Page generated in 0.08197 seconds