Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions docs/src/site/markdown/index.md.vm
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,23 @@ The following is a list of the items configured in this POM:
- **mailingLists**: The POM sets up generic Apache announcement lists. You should override this.
- **javaVersion**: Java version used for compilation, default value is **$context.get("javaVersion")**.

You can override this property in your project POM to set different Java version for compilation.
Override this property in your project POM to compile for a different Java version.

The `javaVersion` property is used to set the `maven.compiler.*` properties, so they should not be set directly in your project POM.
The `javaVersion` property sets `maven.compiler.release`:

They will be set automatically according to the JDK used for the project build:
```unknown
<maven.compiler.release>\${javaVersion}</maven.compiler.release>
```

- for JDK 8 and older
On JDK 9 and newer, maven-compiler-plugin and maven-javadoc-plugin pass it as `--release`, which also
checks that the code only uses the API of that Java version. On JDK 8 they ignore it and use `source`
and `target`, which then come from the compiler plugin's own defaults unless your project sets them.

```unknown
<maven.compiler.source>\${javaVersion}</maven.compiler.source>
<maven.compiler.target>\${javaVersion}</maven.compiler.target>
```

- for JDK 9 and newer

```unknown
<maven.compiler.release>\${javaVersion}</maven.compiler.release>
```
Do not set `maven.compiler.source` or `maven.compiler.target` in your project POM to change the Java
version: with maven-compiler-plugin 3.x `release` silently takes precedence, and with 4.x javac rejects
the combination. Override `javaVersion` instead. Projects that need `source` and `target` semantics,
for example to use `sun.*` APIs, set `maven.compiler.release` to an empty value and then set `source`
and `target`; that needs maven-javadoc-plugin 3.12.1 or newer.

- **releaseParallelPut**: When doing a release, this property controls whether artifacts are uploaded in parallel (true) or sequentially (false).

Expand Down Expand Up @@ -144,6 +143,7 @@ You can test your environment setup using `-Papache-release` with the command li

# Notices

- Since version **40**, `maven.compiler.release` is set unconditionally from `javaVersion` and the `jdk8` and `jdk9+` profiles are gone; JDK 8 builds no longer get `maven.compiler.source` and `maven.compiler.target` from this POM.
- Since version **36**, the `javaVersion` property has been introduced to define the Java version used for the `maven.compiler.*` properties.
- Since version **32** `maven-site-plugin:attach-descriptor` was removed from `plugins` section.

Expand Down
25 changes: 4 additions & 21 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ under the License.
<gpg.useagent>true</gpg.useagent>
<!-- java version used to to set maven.compiler.* -->
<javaVersion>8</javaVersion>
<!-- maven-compiler-plugin and maven-javadoc-plugin only pass release to a JDK 9+ tool and fall
back to source/target on JDK 8 by themselves, so no JDK-activated profile is needed and the
value also holds when a toolchain JDK differs from the one running Maven (MNG-6943). -->
<maven.compiler.release>${javaVersion}</maven.compiler.release>
<minimalMavenBuildVersion>3.9</minimalMavenBuildVersion>
<minimalJavaBuildVersion>${javaVersion}</minimalJavaBuildVersion>
<assembly.tarLongFileMode>posix</assembly.tarLongFileMode>
Expand Down Expand Up @@ -563,27 +567,6 @@ under the License.
</plugins>
</build>
</profile>
<profile>
<id>jdk8</id>
<activation>
<jdk>[,9)</jdk>
</activation>
<properties>
<maven.compiler.source>${javaVersion}</maven.compiler.source>
<maven.compiler.target>${javaVersion}</maven.compiler.target>
</properties>
</profile>
<profile>
<id>jdk9+</id>
<activation>
<!-- this does not support toolchains, https://issues.apache.org/jira/browse/MNG-6943 -->
<jdk>[9,)</jdk>
</activation>
<properties>
<!-- https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-release.html, affects m-compiler-p and m-javadoc-p -->
<maven.compiler.release>${javaVersion}</maven.compiler.release>
</properties>
</profile>
<profile>
<id>only-eclipse</id>
<activation>
Expand Down