Skip to content

Instantly share code, notes, and snippets.

@seropian
Last active April 3, 2018 09:48
Show Gist options
  • Save seropian/36a49fedc3fcdf349e632995661909db to your computer and use it in GitHub Desktop.
Save seropian/36a49fedc3fcdf349e632995661909db to your computer and use it in GitHub Desktop.
Compile main code with default java compiler and compile test code with eclipse-groovy compiler, with unit tests and integration tests in separate directories
<?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>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<groupId>eu.seropian.maven</groupId>
<artifactId>demo</artifactId>
<name>root pom</name>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
<pluginRepositories>
<pluginRepository>
<id>bintray</id>
<name>Groovy Bintray</name>
<url>https://dl.bintray.com/groovy/maven</url>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<inherited>true</inherited>
<executions>
<execution>
<id>default-testCompile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<fork>true</fork>
<!--<compilerVersion>1.8</compilerVersion>-->
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
<debug>true</debug>
<optimize>false</optimize>
<verbose>true</verbose>
<compilerId>groovy-eclipse-compiler</compilerId>
</configuration>
</execution>
<execution>
<id>integration-testCompile</id>
<phase>pre-integration-test</phase>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<fork>true</fork>
<!--<compilerVersion>1.8</compilerVersion>-->
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
<debug>true</debug>
<optimize>false</optimize>
<verbose>true</verbose>
<compilerId>groovy-eclipse-compiler</compilerId>
<compileSourceRoots>
<compileSourceRoot>src/test/integration/java</compileSourceRoot>
</compileSourceRoots>
<outputDirectory>
${project.build.directory}/integration-test-classes
</outputDirectory>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>2.9.2-04</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>2.4.13-02</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<inherited>true</inherited>
<configuration>
<forkMode>once</forkMode>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.21.0</version>
<inherited>true</inherited>
<extensions>true</extensions>
<executions>
<execution>
<id>integration-test</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
<configuration>
<testSourceDirectory>src/test/integration/java</testSourceDirectory>
<testClassesDirectory>
${project.build.directory}/integration-test-classes
</testClassesDirectory>
<includes>*</includes>
</configuration>
</execution>
<execution>
<id>verify</id>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<forkMode>once</forkMode>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<inherited>true</inherited>
</plugin>
</plugins>
</build>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment