#169 Copying sources instead of classes from core-common to core/core-jdk to improve IDE experience; Splitting up integration tests

This commit is contained in:
Gunnar Morling 2014-05-30 09:13:55 +02:00
parent 5a04f4635e
commit 1ead23ad9c
11 changed files with 202 additions and 107 deletions

View File

@ -61,6 +61,26 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -32,6 +32,11 @@
<artifactId>mapstruct-jdk8</artifactId> <artifactId>mapstruct-jdk8</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>MapStruct Core JDK 8</name> <name>MapStruct Core JDK 8</name>
<description>MapStruct annotations to be used with JDK 8 and later</description>
<properties>
<common.sources.dir>copied-common-sources</common.sources.dir>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
@ -74,19 +79,39 @@
<target>1.8</target> <target>1.8</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-copied-common-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/${common.sources.dir}</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId> <artifactId>maven-dependency-plugin</artifactId>
<executions> <executions>
<execution> <execution>
<id>add-copied-common-sources</id>
<phase>process-resources</phase> <phase>process-resources</phase>
<goals> <goals>
<goal>unpack-dependencies</goal> <goal>unpack-dependencies</goal>
</goals> </goals>
<configuration> <configuration>
<includeArtifactIds>mapstruct-common</includeArtifactIds> <includeArtifactIds>mapstruct-common</includeArtifactIds>
<includes>**/*.class</includes> <includes>**/*.java</includes>
<outputDirectory>${project.build.outputDirectory}</outputDirectory> <classifier>sources</classifier>
<outputDirectory>${project.build.directory}/${common.sources.dir}</outputDirectory>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>

View File

@ -33,6 +33,10 @@
<packaging>jar</packaging> <packaging>jar</packaging>
<name>MapStruct Core</name> <name>MapStruct Core</name>
<properties>
<common.sources.dir>copied-common-sources</common.sources.dir>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>${project.groupId}</groupId> <groupId>${project.groupId}</groupId>
@ -79,19 +83,39 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-copied-common-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/${common.sources.dir}</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId> <artifactId>maven-dependency-plugin</artifactId>
<executions> <executions>
<execution> <execution>
<id>add-copied-common-sources</id>
<phase>process-resources</phase> <phase>process-resources</phase>
<goals> <goals>
<goal>unpack-dependencies</goal> <goal>unpack-dependencies</goal>
</goals> </goals>
<configuration> <configuration>
<includeArtifactIds>mapstruct-common</includeArtifactIds> <includeArtifactIds>mapstruct-common</includeArtifactIds>
<includes>**/*.class</includes> <includes>**/*.java</includes>
<outputDirectory>${project.build.outputDirectory}</outputDirectory> <classifier>sources</classifier>
<outputDirectory>${project.build.directory}/${common.sources.dir}</outputDirectory>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>

View File

@ -0,0 +1,118 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2012-2014 Gunnar Morling (http://www.gunnarmorling.de/)
and/or other contributors as indicated by the @authors tag. See the
copyright.txt file in the distribution for a full listing of all
contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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>org.mapstruct</groupId>
<artifactId>mapstruct-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../parent/pom.xml</relativePath>
</parent>
<artifactId>mapstruct-integrationtest-jdk8</artifactId>
<packaging>jar</packaging>
<name>MapStruct Integration Tests for JDK 8</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mapstruct-jdk8</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easytesting</groupId>
<artifactId>fest-assert</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<configuration>
<defaultOutputDirectory>${project.build.directory}/generated-sources/mapstruct</defaultOutputDirectory>
<processors>
<processor>org.mapstruct.ap.MappingProcessor</processor>
</processors>
<options>
<!-- suppressGeneratorTimestamp=false is the default -->
<suppressGeneratorTimestamp>false</suppressGeneratorTimestamp>
</options>
</configuration>
<executions>
<execution>
<id>process</id>
<phase>generate-sources</phase>
<goals>
<goal>process</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<executions>
<execution>
<id>check-style</id>
<phase>verify</phase>
<goals>
<goal>checkstyle</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -20,9 +20,7 @@
package org.mapstruct.itest.java8; package org.mapstruct.itest.java8;
import static org.fest.assertions.Assertions.assertThat; import static org.fest.assertions.Assertions.assertThat;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test; import org.junit.Test;
/** /**
@ -32,12 +30,6 @@ import org.junit.Test;
*/ */
public class Java8MapperTest { public class Java8MapperTest {
@Deployment
public static JavaArchive createDeployment() {
return ShrinkWrap.create( JavaArchive.class )
.addPackage( Java8Mapper.class.getPackage() );
}
@Test @Test
public void shouldMapWithRepeatedMappingAnnotation() { public void shouldMapWithRepeatedMappingAnnotation() {
Java8Mapper mapper = Java8Mapper.INSTANCE; Java8Mapper mapper = Java8Mapper.INSTANCE;

View File

@ -34,6 +34,13 @@
<name>MapStruct Integration Test</name> <name>MapStruct Integration Test</name>
<dependencies> <dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mapstruct</artifactId>
<scope>provided</scope>
</dependency>
<!-- Testing -->
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
@ -211,97 +218,4 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<profiles>
<profile>
<id>jdk-lt-8</id>
<activation>
<jdk>[,1.8)</jdk>
</activation>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mapstruct</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-compile</id>
<phase>compile</phase>
<configuration>
<excludes>
<exclude>**/java8/</exclude>
</excludes>
</configuration>
<goals>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<configuration>
<testExcludes>
<exclude>**/java8/</exclude>
</testExcludes>
</configuration>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<executions>
<execution>
<id>process</id>
<phase>generate-sources</phase>
<configuration>
<excludes>
<exclude>**/java8/</exclude>
</excludes>
</configuration>
<goals>
<goal>process</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>jdk-geq-8</id>
<activation>
<jdk>1.8</jdk>
</activation>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mapstruct-jdk8</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project> </project>

View File

@ -372,6 +372,7 @@
<versionRange>[2.4,)</versionRange> <versionRange>[2.4,)</versionRange>
<goals> <goals>
<goal>copy-dependencies</goal> <goal>copy-dependencies</goal>
<goal>unpack-dependencies</goal>
</goals> </goals>
</pluginExecutionFilter> </pluginExecutionFilter>
<action> <action>
@ -489,7 +490,7 @@
<configuration> <configuration>
<rules> <rules>
<requireJavaVersion> <requireJavaVersion>
<version>[1.6,)</version> <version>[1.8,)</version>
</requireJavaVersion> </requireJavaVersion>
<DependencyConvergence /> <DependencyConvergence />
<requirePluginVersions /> <requirePluginVersions />

View File

@ -42,6 +42,7 @@
<module>core-jdk8</module> <module>core-jdk8</module>
<module>processor</module> <module>processor</module>
<module>integrationtest</module> <module>integrationtest</module>
<module>integrationtest-jdk8</module>
</modules> </modules>
<build> <build>