You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2024/08/04 20:43:32 UTC
(freemarker) branch 2.3-gae updated: Build: Some build cleanup, and documentation regarding static linking to _Java9Impl/_Java16Impl using the multi-release JAR format.
This is an automated email from the ASF dual-hosted git repository.
ddekany pushed a commit to branch 2.3-gae
in repository https://gitbox.apache.org/repos/asf/freemarker.git
The following commit(s) were added to refs/heads/2.3-gae by this push:
new d03f7f79 Build: Some build cleanup, and documentation regarding static linking to _Java9Impl/_Java16Impl using the multi-release JAR format.
d03f7f79 is described below
commit d03f7f79b0e2ebdfa6586a196c3afc80f0511dec
Author: ddekany <dd...@apache.org>
AuthorDate: Sun Aug 4 22:42:33 2024 +0200
Build: Some build cleanup, and documentation regarding static linking to _Java9Impl/_Java16Impl using the multi-release JAR format.
---
README.md | 5 +++++
.../src/main/kotlin/freemarker/build/FreemarkerRootExtension.kt | 2 --
freemarker-manual/src/main/docgen/en_US/book.xml | 9 ++++++++-
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 59a40955..d9f26062 100644
--- a/README.md
+++ b/README.md
@@ -137,6 +137,11 @@ Reproducible builds: If the resulting `freemarker.jar` is not identical with the
in the `.buildinfo` file packed into the official source distribution, and also into the Maven "sources" artifact! At
least with identical Java versions, the resulting `freemarker.jar` meant to match exactly.
+Note on trying things out with an ad-hoc class that has `main` method: Don't do that, instead write it as a JUnit test.
+FreeMarker needs to be loaded from `freemarker.jar` that contains the `META-INF/versions` directory (as per JEP 238,
+Multi-Release JAR Files). If you run a test, Gradle ensures that you have an up-to-date `freemarker.jar`, and
+that it's in the classpath. Without that, FreeMarker will behave as if you are on a lower Java version.
+
### Maven-related build tasks
diff --git a/buildSrc/src/main/kotlin/freemarker/build/FreemarkerRootExtension.kt b/buildSrc/src/main/kotlin/freemarker/build/FreemarkerRootExtension.kt
index 6bfc569a..2222b9d2 100644
--- a/buildSrc/src/main/kotlin/freemarker/build/FreemarkerRootExtension.kt
+++ b/buildSrc/src/main/kotlin/freemarker/build/FreemarkerRootExtension.kt
@@ -230,8 +230,6 @@ class FreemarkerModuleDef internal constructor(
.toString()
systemProperty("freemarker.test.resourcesDir", resourcesDestDir)
- testClassesDirs = sources.output.classesDirs
-
// We have to build the jar and depend on that, because we depend on "JEP 238: Multi-Release JAR Files",
// which puts some classes into the jar under META-INF\versions\$javaVersion.
val jarClasspath = project.objects.fileCollection()
diff --git a/freemarker-manual/src/main/docgen/en_US/book.xml b/freemarker-manual/src/main/docgen/en_US/book.xml
index 5813d09c..d776fd3d 100644
--- a/freemarker-manual/src/main/docgen/en_US/book.xml
+++ b/freemarker-manual/src/main/docgen/en_US/book.xml
@@ -30149,7 +30149,14 @@ TemplateModel x = env.getVariable("x"); // get variable x</programlisting>
<literal>16</literal>, instead of in the usual location together
with Java 8 byte code class files. This was needed as some
tools, like Maven Enforcer plugin, have seen them as problems
- otherwise.</para>
+ otherwise. Also, now we don't look for the
+ <literal>_Java<replaceable>X</replaceable>Impl</literal> classes
+ with <literal>Class.forName(String)</literal>, instead we just
+ refer them normally, as now Java will link to the proper variant
+ according the multi-release JAR format. This can help if some
+ environment doesn't support class loading on runtime (however,
+ then you still will have problems with other optional
+ features).</para>
</listitem>
</itemizedlist>
</section>