From ec413118d6fb21f0eeafab6d9c61daa95825c50f Mon Sep 17 00:00:00 2001 From: Filip Hrisafov Date: Sun, 28 Oct 2018 21:39:35 +0100 Subject: [PATCH] Update build with latest dependencies and Java 8 baseline: (#1636) * Do not use maven-processor-plugin and use the maven-compiler-plugin annotationProcessors instead * Update NoPackageCyclesRule and exclude tests * Update checkstyle to 8.14 and remove FIleContentsHolder module and move SuppressionCommentFilter to the TreeWalker * Update assertj to 3.11.1 and replace usage of RuntimeIOException (from AssertJ) with UncheckedIOException (from java 8) * Add how to import MapStruct into IntelliJ and Eclipse into the readme --- .../resources/build-config/checkstyle.xml | 4 +- parent/pom.xml | 71 ++++++++----------- processor/pom.xml | 52 ++------------ .../testutil/assertions/JavaFileAssert.java | 4 +- readme.md | 14 ++++ 5 files changed, 51 insertions(+), 94 deletions(-) diff --git a/build-config/src/main/resources/build-config/checkstyle.xml b/build-config/src/main/resources/build-config/checkstyle.xml index 1f371acd2..9051361d1 100644 --- a/build-config/src/main/resources/build-config/checkstyle.xml +++ b/build-config/src/main/resources/build-config/checkstyle.xml @@ -62,8 +62,6 @@ - - @@ -202,9 +200,9 @@ + - diff --git a/parent/pom.xml b/parent/pom.xml index 0ac7060b0..7ac85a46f 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -22,15 +22,18 @@ UTF-8 1.0.0 - 1.2 - 2.19.1 - 3.0.0-M1 + 3.0.0-M2 + 2.22.1 + 3.0.1 4.0.3.RELEASE 0.26.0 - 7.2 + 8.14 1 - 3.7.0 + 3.11.1 + + + jdt_apt @@ -268,12 +271,12 @@ org.apache.maven.plugins maven-assembly-plugin - 2.4 + 3.1.0 org.apache.maven.plugins maven-checkstyle-plugin - 2.17 + 3.0.0 build-config/checkstyle.xml true @@ -305,7 +308,7 @@ org.apache.maven.plugins maven-clean-plugin - 2.5 + 3.1.0 org.apache.maven.plugins @@ -314,18 +317,17 @@ 1.8 1.8 - -proc:none org.apache.maven.plugins maven-dependency-plugin - 2.8 + 3.1.1 org.apache.maven.plugins maven-deploy-plugin - 2.8.2 + 3.0.0-M1 true @@ -343,14 +345,14 @@ de.andrena.tools.nopackagecycles no-package-cycles-enforcer-rule - 1.0.5 + 1.0.9 org.apache.felix maven-bundle-plugin - 3.0.1 + 4.0.0 bundle-manifest @@ -364,12 +366,12 @@ org.apache.maven.plugins maven-install-plugin - 2.5.2 + 3.0.0-M1 org.apache.maven.plugins maven-jar-plugin - 3.0.2 + 3.1.0 org.apache.maven.plugins @@ -398,7 +400,7 @@ org.apache.maven.plugins maven-resources-plugin - 2.6 + 3.1.0 org.apache.maven.plugins @@ -408,7 +410,7 @@ org.apache.maven.plugins maven-site-plugin - 3.6 + 3.7.1 org.apache.maven.plugins @@ -419,13 +421,6 @@ -Xms1024m -Xmx3072m - - - org.apache.maven.surefire - surefire-junit47 - ${org.apache.maven.plugins.surefire.version} - - org.apache.maven.plugins @@ -437,25 +432,15 @@ maven-license-plugin 1.10.b1 - - org.bsc.maven - maven-processor-plugin - 2.2.4 - - - org.codehaus.mojo - build-helper-maven-plugin - 1.8 - org.codehaus.mojo animal-sniffer-maven-plugin - 1.16 + 1.17 org.ow2.asm - asm-all - 5.2 + asm + 6.2.1 @@ -513,12 +498,12 @@ org.jacoco jacoco-maven-plugin - 0.7.9 + 0.8.2 org.jvnet.jaxb2.maven2 maven-jaxb2-plugin - 0.9.0 + 0.14.0 org.codehaus.mojo @@ -528,7 +513,7 @@ de.thetaphi forbiddenapis - 2.3 + 2.6 ${project.basedir}/../etc/forbidden-apis.txt @@ -538,7 +523,7 @@ com.github.siom79.japicmp japicmp-maven-plugin - 0.10.0 + 0.13.0 verify @@ -660,7 +645,9 @@ test-compile - + + false + diff --git a/processor/pom.xml b/processor/pom.xml index f71ede86b..eb307ffa6 100644 --- a/processor/pom.xml +++ b/processor/pom.xml @@ -21,7 +21,6 @@ MapStruct Processor - ${project.build.directory}/generated-sources/prims @@ -221,54 +220,13 @@ - org.bsc.maven - maven-processor-plugin + org.apache.maven.plugins + maven-compiler-plugin - ${prism.directory} - - net.java.dev.hickory.prism.internal.PrismGenerator - - + + net.java.dev.hickory.prism.internal.PrismGenerator + - - - process - generate-sources - - process - - - - - - com.jolira - hickory - ${com.jolira.hickory.version} - - - org.eclipse.tycho - tycho-compiler-jdt - ${org.eclipse.tycho.compiler-jdt.version} - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-source - generate-sources - - add-source - - - - ${prism.directory} - - - - org.apache.maven.plugins diff --git a/processor/src/test/java/org/mapstruct/ap/testutil/assertions/JavaFileAssert.java b/processor/src/test/java/org/mapstruct/ap/testutil/assertions/JavaFileAssert.java index 8e8b4d0f7..9b374273f 100644 --- a/processor/src/test/java/org/mapstruct/ap/testutil/assertions/JavaFileAssert.java +++ b/processor/src/test/java/org/mapstruct/ap/testutil/assertions/JavaFileAssert.java @@ -9,6 +9,7 @@ import static java.lang.String.format; import java.io.File; import java.io.IOException; +import java.io.UncheckedIOException; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Iterator; @@ -17,7 +18,6 @@ import java.util.List; import org.assertj.core.api.AbstractCharSequenceAssert; import org.assertj.core.api.Assertions; import org.assertj.core.api.FileAssert; -import org.assertj.core.api.exception.RuntimeIOException; import org.assertj.core.error.ShouldHaveSameContent; import org.assertj.core.internal.Diff; import org.assertj.core.internal.Failures; @@ -111,7 +111,7 @@ public class JavaFileAssert extends FileAssert { } } catch ( IOException e ) { - throw new RuntimeIOException( format( + throw new UncheckedIOException( format( "Unable to compare contents of files:<%s> and:<%s>", actual, expected diff --git a/readme.md b/readme.md index 9e5d354e5..8260bcb2f 100644 --- a/readme.md +++ b/readme.md @@ -138,6 +138,20 @@ MapStruct uses Maven for its build. Java 8 is required for building MapStruct fr from the root of the project directory. To skip the distribution module, run mvn clean install -DskipDistribution=true + +## Importing into IDE + +MapStruct uses the hickory annotation processor to generate mapping prisms for it's own annotations. +Therefore for seamless integration within an IDE annotation processing needs to be enabled. + +### IntelliJ + +Make sure that you have at least IntelliJ 2018.2.x (needed since support for `annotationProcessors` from the `maven-compiler-plugin` is from that version). +Enable annotation processing in IntelliJ (Build, Execution, Deployment -> Compiler -> Annotation Processors) + +### Eclipse + +Make sure that you have the [m2e_apt](https://marketplace.eclipse.org/content/m2e-apt) plugin installed. ## Links