Skip to content

Instantly share code, notes, and snippets.

@bondolo
Created September 10, 2020 20:19
Show Gist options
  • Save bondolo/37536d91df16db1362ae393230d7b89b to your computer and use it in GitHub Desktop.
Save bondolo/37536d91df16db1362ae393230d7b89b to your computer and use it in GitHub Desktop.
Conditionally activating <release> with Java 9+ Maven Compiler plugin
<profile>
<id>Java 9+ configuration</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!-- Use -release compiler option rather than source/target if 9+ -->
<release>${maven.compiler.target}</release>
</configuration>
</plugin>
</plugins>
</build>
<activation>
<jdk>[1.9,)</jdk>
</activation>
</profile>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment