blob: 7fb68fbd724de03b6681b01be0a4d45c64cbdf50 [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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
https://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.apache.plc4x</groupId>
<artifactId>plc4x-parent</artifactId>
<version>0.10.0</version>
</parent>
<artifactId>plc4j</artifactId>
<packaging>pom</packaging>
<name>PLC4J</name>
<description>Implementation of the protocol adapters for usage as Java library.</description>
<modules>
<module>api</module>
<module>drivers</module>
<module>examples</module>
<module>integrations</module>
<module>spi</module>
<module>tools</module>
<module>transports</module>
<module>utils</module>
<module>osgi</module>
</modules>
<build>
<plugins>
<!-- Compile any groovy code located in "src/test/groovy" -->
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.13.1</version>
<executions>
<execution>
<id>compile-groovy-tests</id>
<phase>test-compile</phase>
<goals>
<goal>addTestSources</goal>
<goal>compileTests</goal>
</goals>
</execution>
</executions>
</plugin>
<!--
This plugin doesn't really do much, it makes sure the jacoco agent
is downloaded and that the path to this is saved in an environment
variable so we can access this later on in the build.
-->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<!--
Prepares the property pointing to the JaCoCo runtime agent which
is passed as VM argument when Maven the Surefire plugin is executed.
-->
<execution>
<id>pre-unit-test</id>
<phase>generate-test-sources</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<!--
Sets the name of the property containing the settings
for JaCoCo runtime agent.
-->
<propertyName>surefireArgLine</propertyName>
</configuration>
</execution>
<!--
Prepares the property pointing to the JaCoCo runtime agent which
is passed as VM argument when Maven the Failsafe plugin is executed.
-->
<execution>
<id>pre-integration-test</id>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
<configuration>
<!--
Sets the name of the property containing the settings
for JaCoCo runtime agent.
-->
<propertyName>failsafeArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>report</id>
<phase>verify</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<!--
Check if the unit-test-coverage is at least a certain minimum.
-->
<execution>
<id>check-coverage</id>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<!-- TODO: Turn this on as soon as possible. -->
<haltOnFailure>false</haltOnFailure>
<rules>
<rule implementation="org.jacoco.maven.RuleConfiguration">
<element>BUNDLE</element>
<limits>
<!-- Fail the build if the instruction level coverage is below 80%. -->
<limit implementation="org.jacoco.report.check.Limit">
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>0.50</minimum>
</limit>
<!-- Fail the build if there are classes without any coverage. -->
<limit implementation="org.jacoco.report.check.Limit">
<counter>CLASS</counter>
<value>MISSEDCOUNT</value>
<maximum>0</maximum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<!--
As our libraries should be consumable on Java 1.8, downgrade the compiler settings.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>8</release>
</configuration>
</execution>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>testCompile</goal>
</goals>
<configuration>
<release>11</release>
</configuration>
</execution>
</executions>
</plugin>
<!--
Make the surefire execute all unit-tests
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!--
We have to slightly increase the heap-size or some tests will fail.
Notice the @ instead of the $ as prefix? That's late evaluation.
-->
<argLine>-Xmx256m @{surefireArgLine}</argLine>
<includes>
<include>**/*Test.java</include>
<include>**/*Tests.java</include>
<include>**/*Spec.java</include>
</includes>
<environmentVariables>
<!-- Pass in to the build, if all tests should be run -->
<ENABLE_ALL_TESTS>${enable-all-tests}</ENABLE_ALL_TESTS>
</environmentVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<!--
The failsafe plugin would use the java jigsaw module path,
this would make loading the test XML files impossible.
So we simply disable this.
-->
<useModulePath>false</useModulePath>
<!--
We have to slightly increase the heap-size or some tests will fail.
Notice the @ instead of the $ as prefix? That's late evaluation.
-->
<argLine>-Xmx256m @{failsafeArgLine}</argLine>
<includes>
<include>**/*IT.java</include>
</includes>
<environmentVariables>
<!-- Pass in to the build, if all tests should be run -->
<ENABLE_ALL_TESTS>${enable-all-tests}</ENABLE_ALL_TESTS>
</environmentVariables>
</configuration>
</plugin>
<!--
Generate an OSGI compatible MANIFEST file.
-->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<exportScr>true</exportScr>
<instructions>
<_include>-bnd.bnd</_include>
<_removeheaders>Bnd-LastModified,Built-By</_removeheaders>
</instructions>
</configuration>
</plugin>
<!--
Use the MANIFEST file generated by the maven-bundle-plugin.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<!--
Even if Maven transitively pulls in dependencies, relying on these can
quite often cause hard to find problems. So it's a good practice to make
sure everything directly required is also directly added as a dependency.
On the other side adding unused dependency only over-complicates the
the dependency graph, so the maven-dependency-plugin checks we depend on
what we need and only that and that runtime dependencies are correctly
imported with runtime scope.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>check-dependencies</id>
<phase>verify</phase>
<goals>
<goal>analyze-only</goal>
</goals>
<configuration>
<failOnWarning>true</failOnWarning>
<ignoreNonCompile>true</ignoreNonCompile>
<ignoredDependencies>
<ignoredDependency>org.assertj:assertj-core</ignoredDependency>
<ignoredDependency>org.junit.jupiter:junit-jupiter</ignoredDependency>
<ignoredDependency>org.junit.jupiter:junit-jupiter-api</ignoredDependency>
<ignoredDependency>org.junit.jupiter:junit-jupiter-params</ignoredDependency>
<ignoredDependency>org.opentest4j:opentest4j</ignoredDependency>
<ignoredDependency>org.hamcrest:hamcrest</ignoredDependency>
<ignoredDependency>org.hamcrest:hamcrest-core</ignoredDependency>
<ignoredDependency>org.hamcrest:hamcrest-library</ignoredDependency>
<ignoredDependency>org.mockito:mockito-core</ignoredDependency>
<ignoredDependency>org.mockito:mockito-junit-jupiter</ignoredDependency>
<ignoredDependency>org.slf4j:slf4j-api</ignoredDependency>
<ignoredDependency>ch.qos.logback:logback-classic</ignoredDependency>
<ignoredDependency>org.apache.groovy:groovy-test-junit5</ignoredDependency>
<ignoredDependency>org.apache.groovy:groovy</ignoredDependency>
<ignoredDependency>com.athaydes:spock-reports</ignoredDependency>
<ignoredDependency>org.apache.nifi:nifi-standard-nar</ignoredDependency>
</ignoredDependencies>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- Dependencies common to all java modules -->
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<!-- JUnit 5 Support -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.groovy</groupId>
<artifactId>groovy-test-junit5</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>