Skip to content

Commit 63b6e38

Browse files
committed
Move maven-compiler-plugin config to properties
This makes it easier to override only the source or target versions (by overriding maven.compiler.source or maven.compiler.target, respectively) without needing to introduce a <build> section in the downstream POM.
1 parent f28099a commit 63b6e38

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed

pom.xml

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -157,11 +157,20 @@
157157
<!-- Extra maven-surefire-plugin args. -->
158158
<scijava.surefire.args />
159159

160-
<!-- Target version of the Java platform. -->
160+
<!-- Compiler configuration. -->
161161
<scijava.jvm.version>1.8</scijava.jvm.version>
162162
<scijava.jvm.test.version>${scijava.jvm.version}</scijava.jvm.test.version>
163163
<!-- NB: 1.8.0_101 is needed for SciJava Maven repository HTTPS support. -->
164164
<scijava.jvm.build.version>[1.8.0-101,1.8.9999]</scijava.jvm.build.version>
165+
<maven.compiler.source>${scijava.jvm.version}</maven.compiler.source>
166+
<maven.compiler.target>${scijava.jvm.version}</maven.compiler.target>
167+
<maven.compiler.testSource>${scijava.jvm.test.version}</maven.compiler.testSource>
168+
<maven.compiler.testTarget>${scijava.jvm.test.version}</maven.compiler.testTarget>
169+
<!--
170+
Workaround for a bug in maven-compiler-plugin.
171+
See https://issues.apache.org/jira/browse/MCOMPILER-209
172+
-->
173+
<maven.compiler.useIncrementalCompilation>false</maven.compiler.useIncrementalCompilation>
165174

166175
<!-- Minimum required Maven version to build the project. -->
167176
<scijava.mvn.version>3.3.9</scijava.mvn.version>
@@ -275,17 +284,6 @@
275284
<plugin>
276285
<artifactId>maven-compiler-plugin</artifactId>
277286
<version>${maven-compiler-plugin.version}</version>
278-
<configuration>
279-
<source>${scijava.jvm.version}</source>
280-
<target>${scijava.jvm.version}</target>
281-
<testSource>${scijava.jvm.test.version}</testSource>
282-
<testTarget>${scijava.jvm.test.version}</testTarget>
283-
<!--
284-
Workaround for a bug in maven-compiler-plugin.
285-
See https://issues.apache.org/jira/browse/MCOMPILER-209
286-
-->
287-
<useIncrementalCompilation>false</useIncrementalCompilation>
288-
</configuration>
289287
</plugin>
290288

291289
<plugin>
@@ -1811,20 +1809,6 @@
18111809
</plugins>
18121810
</pluginManagement>
18131811
<plugins>
1814-
<!--
1815-
HACK - Tell Eclipse to use the TEST source and target JVM version.
1816-
This is necessary because the JVM version used for tests may be newer
1817-
than that used for the main artifact. Maven is OK with this, but
1818-
Eclipse wants only a single JVM version for both main and tests.
1819-
See: https://gist.github.com/aslakknutsen/9648594#gistcomment-1588906
1820-
-->
1821-
<plugin>
1822-
<artifactId>maven-compiler-plugin</artifactId>
1823-
<configuration>
1824-
<source>${scijava.jvm.test.version}</source>
1825-
<target>${scijava.jvm.test.version}</target>
1826-
</configuration>
1827-
</plugin>
18281812
<plugin>
18291813
<groupId>org.scijava</groupId>
18301814
<artifactId>scijava-maven-plugin</artifactId>
@@ -1839,6 +1823,17 @@
18391823
</plugin>
18401824
</plugins>
18411825
</build>
1826+
<properties>
1827+
<!--
1828+
HACK - Tell Eclipse to use the TEST source and target JVM version.
1829+
This is necessary because the JVM version used for tests may be newer
1830+
than that used for the main artifact. Maven is OK with this, but
1831+
Eclipse wants only a single JVM version for both main and tests.
1832+
See: https://gist.github.com/aslakknutsen/9648594#gistcomment-1588906
1833+
-->
1834+
<maven.compiler.source>${scijava.jvm.test.version}</maven.compiler.source>
1835+
<maven.compiler.target>${scijava.jvm.test.version}</maven.compiler.target>
1836+
</properties>
18421837
</profile>
18431838

18441839
<!--

0 commit comments

Comments
 (0)