Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FREEMARKER-218 - Add jakarta.servlet support #94

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# under the License.

/.ivy/
/.jython_cache/
/.bin/
/build/
/build.properties
Expand All @@ -31,6 +32,7 @@
.project
.settings
bnd.bnd
junit*.properties

.idea/
*.iml
Expand Down
33 changes: 15 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Apache FreeMarker {version}
===========================

[![Build Status](https://travis-ci.org/apache/freemarker.svg?branch=2.3-gae)](https://travis-ci.org/apache/freemarker)
[![Build Status](https://travis-ci.org/apache/freemarker.svg?branch=2.4-gae)](https://travis-ci.org/apache/freemarker)

For the latest version or to report bugs visit:
https://freemarker.apache.org/
Expand Down Expand Up @@ -83,7 +83,7 @@ dependency, as freemarker.ext.dom can't use the XPath support
included in OpenJDK anymore. It's not needed on Oracle Java 9,
or if FreeMarker is configured to use Jaxen for XPath.

The minimum required Java version is currently Java SE 7. (The presence
The minimum required Java version is currently Java SE 17. (The presence
of a later version may be detected on runtime and utilized by
FreeMarker.)

Expand All @@ -106,9 +106,9 @@ If you haven't yet, download the source release, or checkout FreeMarker from
the source code repository. See repository locations here:
https://freemarker.apache.org/sourcecode.html

You need JDK 8 (not JDK 9!), Apache Ant (tested with 1.9.6) and Ivy (tested
with 2.5.0) to be installed. To install Ivy (but be sure it's not already
installed), issue `ant download-ivy`; it will copy Ivy under `~/.ant/lib`.
You need JDK 17, Apache Ant (tested with 1.9.6) and Ivy (tested with 2.5.0)
to be installed. To install Ivy (but be sure it's not already installed),
issue `ant download-ivy`; it will copy Ivy under `~/.ant/lib`.
(Alternatively, you can copy `ivy-<version>.jar` into the Ant home `lib`
subfolder manually.)

Expand Down Expand Up @@ -165,7 +165,7 @@ Below you find the step-by-step setup for Eclipse (originally done on Mars.1):
Number of imports required for .*: 99
Number of static imports needed for .*: 1
- Java -> Installed JRE-s:
Ensure that you have JDK 8 installed, and that it was added to Eclipse.
Ensure that you have JDK 17 installed, and that it was added to Eclipse.
Note that it's not JRE, but JDK.
- Java -> Compiler -> Javadoc:
"Malformed Javadoc comments": Error
Expand All @@ -188,13 +188,13 @@ Below you find the step-by-step setup for Eclipse (originally done on Mars.1):
src/test/resources
- On the "Libraries" tab:
- Delete everyhing from there, except the "JRE System Library [...]"
- Edit "JRE System Library [...]" to "Execution Environment" "JavaSE 1.8"
- Edit "JRE System Library [...]" to "Execution Environment" "JavaSE 17"
- Add all jar-s that are directly under the "ide-dependencies" directory
(use the "Add JARs..." and select all those files).
- Press "Finish"
- Eclipse will indicate many errors at this point; it's expected, read on.
- Project -> Properties -> Java Compiler
- Set "Compiler Compliance Level" to "1.7" (you will have to uncheck
- Set "Compiler Compliance Level" to "17" (you will have to uncheck
"Use compliance from execution environment" for that)
- In Errors/Warnings, check in "Enable project specific settings", then set
"Forbidden reference (access rules)" from "Error" to "Warning".
Expand All @@ -206,7 +206,6 @@ Below you find the step-by-step setup for Eclipse (originally done on Mars.1):
_Jython22*.java,
_FreeMarkerPageContext2.java,
FreeMarkerJspFactory2.java,
Java8*.java
Also, close these files if they are open. Now you shouldn't have any errors.
- At Project -> Properties -> Java Code Style -> Formatter, check in "Enable
project specific settings", and then select "FreeMarker" as active profile.
Expand All @@ -233,15 +232,15 @@ Originally done on IntelliJ IDEA Community 2018.2.4:

- "New" -> "Project". In order as the IntelliJ will prompt you:

- Select "Java" on the left side, and "1.8" for SDK on the right side. Press "Next".
- Select "Java" on the left side, and "17" for SDK on the right side. Press "Next".

- Template selection: Don't chose anything, "Next"

- Project name: "FreeMarker-2.3-gae".
Project location: Wherever you have checked out the 2.3-gae branch from Git.
- Project name: "FreeMarker-2.4-gae".
Project location: Wherever you have checked out the 2.4-gae branch from Git.
Press "Finish"

- Open your newly created "FreeMarker-2.3-gae" project
- Open your newly created "FreeMarker-2.4-gae" project

- "File" -> "Project Structure..."

Expand All @@ -264,10 +263,9 @@ Originally done on IntelliJ IDEA Community 2018.2.4:

- Test Resource Folders:
src/test/resources

- Still inside the "Sources" tab, change the "Language level" to "7". (Yes, we use Java 8 SDK with
language level 7 in the IDE, due to the tricks FreeMarker uses to support different Java versions.)


- Still inside the "Sources" tab, change the "Language level" to "17".

- Switch over to the "Dependencies" tab (still inside "Project Structure" / "Modules"), and add
all the jar-s inside the `ide-dependencies` directory as dependency. (How: Click the "+" icon
at the right edge, select "JARs or directory", navigate to `ide-dependencies` directory, expand
Expand All @@ -281,7 +279,6 @@ Originally done on IntelliJ IDEA Community 2018.2.4:
_Jython22*.java,
_FreeMarkerPageContext2.java,
FreeMarkerJspFactory2.java,
Java8*.java

- You may do "Build" / "Build project" (Ctrl+F9) to see if everything compiles now.

Expand Down
5 changes: 2 additions & 3 deletions build.properties.sample
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

# Copy this file to "build.properties" before editing!
# These propeties should point to the rt.jar-s of the respective J2SE versions:
boot.classpath.j2se1.7=c:/Program Files/Java/jre7/lib/rt.jar
boot.classpath.j2se1.8=C:/Program Files/Java/jdk1.8.0_66/jre/lib/rt.jar
java.home.17=/etc/alternatives/java_sdk_17
mvnCommand=C:/Program Files (x86)/maven3/bin/mvn.bat
gpgCommand=C:/Program Files (x86)/GNU/GnuPG/pub/gpg.exe
gpgCommand=C:/Program Files (x86)/GNU/GnuPG/pub/gpg.exe
94 changes: 32 additions & 62 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,39 +37,30 @@
<!-- Ivy project coordinates: -->
<property name="moduleOrg" value="org.freemarker" />
<property name="moduleName" value="freemarker" />
<property name="moduleBranch" value="2.3" />
<property name="moduleBranch" value="2.4" />

<!-- Will be overidden on the Continous Integration server: -->
<property name="server.ivy.repo.root" value="${basedir}/build/dummy-server-ivy-repo" />

<property file="build.properties"/>
<condition property="has.explicit.boot.classpath.j2se1.7">
<isset property="boot.classpath.j2se1.7"/>
</condition>
<condition property="has.explicit.boot.classpath.j2se1.8">
<isset property="boot.classpath.j2se1.8"/>
<condition property="has.explicit.java.home.17">
<isset property="java.home.17"/>
</condition>
<condition property="has.all.explicit.boot.classpaths">
<and>
<isset property="has.explicit.boot.classpath.j2se1.7"/>
<isset property="has.explicit.boot.classpath.j2se1.8"/>
<isset property="has.explicit.java.home.17"/>
</and>
</condition>
<available property="atLeastJDK8" classname="java.util.function.Predicate"/>
<available property="atLeastJDK17" classname="java.util.function.Predicate"/>

<!-- When boot.classpath.j2se* is missing, these will be the defaults: -->
<!-- When java.home.* is missing, these will be the defaults: -->
<!-- Note: Target "dist" doesn't allow using these. -->
<property name="boot.classpath.j2se1.7" value="${sun.boot.class.path}" />
<property name="boot.classpath.j2se1.8" value="${sun.boot.class.path}" />
<property name="java.home.17" value="${sun.boot.class.path}" />

<!-- For checking the correctness of the boot.classpath.j2se* -->
<available classpath="${boot.classpath.j2se1.7}"
classname="java.nio.file.Path" ignoresystemclasses="true"
property="boot.classpath.j2se1.7.correct"
/>
<available classpath="${boot.classpath.j2se1.8}"
classname="java.time.Instant" ignoresystemclasses="true"
property="boot.classpath.j2se1.8.correct"
<available classpath="${java.home.17}"
classname="java.time.Instant"
property="java.home.17.correct"
/>

<!-- Set up version/timestamp filters and the version property: -->
Expand Down Expand Up @@ -102,7 +93,6 @@
<!-- Initialization -->
<!-- ================================================================== -->


<target name="clean" description="get rid of all generated files">
<delete dir="build" />
<delete dir="META-INF" />
Expand Down Expand Up @@ -192,22 +182,15 @@
</target>

<target name="compile" depends="javacc">
<fail unless="boot.classpath.j2se1.7.correct"><!--
-->The "boot.classpath.j2se1.7" property value (${boot.classpath.j2se1.7}) <!--
-->seems to be an incorrect boot classpath. Please fix it in <!--
-->the &lt;projectDir>/build.properties file, or wherever you <!--
-->set it.<!--
--></fail>
<fail unless="boot.classpath.j2se1.8.correct"><!--
-->The "boot.classpath.j2se1.8" property value (${boot.classpath.j2se1.8}) <!--
<fail unless="java.home.17.correct"><!--
-->The "java.home.17" property value (${java.home.17}) <!--
-->seems to be an incorrect boot classpath. Please fix it in <!--
-->the &lt;projectDir>/build.properties file, or wherever you <!--
-->set it.<!--
--></fail>
<echo level="info"><!--
-->Using boot classpaths: <!--
-->Java 7: ${boot.classpath.j2se1.7};<!--
-->Java 8: ${boot.classpath.j2se1.8}<!--
-->Java 17: ${java.home.17};<!--
--></echo>

<!-- Comment out @SuppressFBWarnings, as it causes compilation warnings in dependent Gradle projects -->
Expand All @@ -234,10 +217,10 @@
<!-- Note: the "build.base" conf doesn't include optional FreeMarker dependencies. -->
<ivy:cachepath conf="build.base" pathid="ivy.dep" />
<javac destdir="build/classes" deprecation="off"
debug="on" optimize="off" target="1.7" source="1.7" encoding="utf-8"
debug="on" optimize="off" target="17" source="17" encoding="utf-8"
includeantruntime="false"
classpathref="ivy.dep"
bootclasspath="${boot.classpath.j2se1.7}"
executable="${java.home.17}/bin/javac"
excludes="
freemarker/core/_Java?*Impl.java,
freemarker/ext/jsp/**,
Expand All @@ -256,25 +239,19 @@

<ivy:cachepath conf="build.base" pathid="ivy.dep" />
<javac srcdir="build/src-main-java-filtered" destdir="build/classes" deprecation="off"
debug="on" optimize="off" target="1.8" source="1.8" encoding="utf-8"
debug="on" optimize="off" target="17" source="17" encoding="utf-8"
includeantruntime="false"
classpathref="ivy.dep"
bootclasspath="${boot.classpath.j2se1.8}"
includes="freemarker/core/_Java8Impl.java"
/>

<rmic
base="build/classes" includes="freemarker/debug/impl/Rmi*Impl.class"
classpathref="ivy.dep"
verify="yes" stubversion="1.2"
executable="${java.home.17}/bin/javac"
includes="freemarker/core/_Java17Impl.java"
/>

<ivy:cachepath conf="build.jsp2.0" pathid="ivy.dep.jsp2.0" />
<javac srcdir="build/src-main-java-filtered" destdir="build/classes" deprecation="off"
debug="on" optimize="off" target="1.7" source="1.7" encoding="utf-8"
debug="on" optimize="off" target="17" source="17" encoding="utf-8"
includeantruntime="false"
classpathref="ivy.dep.jsp2.0"
bootclasspath="${boot.classpath.j2se1.7}"
executable="${java.home.17}/bin/javac"
includes="
freemarker/ext/jsp/**,
freemarker/ext/servlet/**,
Expand All @@ -289,10 +266,10 @@

<ivy:cachepath conf="build.jsp2.1" pathid="ivy.dep.jsp2.1" />
<javac srcdir="build/src-main-java-filtered" destdir="build/classes" deprecation="off"
debug="on" optimize="off" target="1.7" source="1.7" encoding="utf-8"
debug="on" optimize="off" target="17" source="17" encoding="utf-8"
includeantruntime="false"
classpathref="ivy.dep.jsp2.1"
bootclasspath="${boot.classpath.j2se1.7}"
executable="${java.home.17}/bin/javac"
includes="
freemarker/ext/jsp/_FreeMarkerPageContext21.java,
freemarker/ext/jsp/FreeMarkerJspFactory21.java,
Expand All @@ -301,10 +278,10 @@

<ivy:cachepath conf="build.jython2.0" pathid="ivy.dep.jython2.0" />
<javac srcdir="build/src-main-java-filtered" destdir="build/classes" deprecation="off"
debug="on" optimize="off" target="1.7" source="1.7" encoding="utf-8"
debug="on" optimize="off" target="17" source="17" encoding="utf-8"
includeantruntime="false"
classpathref="ivy.dep.jython2.0"
bootclasspath="${boot.classpath.j2se1.7}"
executable="${java.home.17}/bin/javac"
includes="
freemarker/ext/ant/**,
freemarker/template/utility/JythonRuntime.java,
Expand All @@ -316,29 +293,24 @@

<ivy:cachepath conf="build.jython2.2" pathid="ivy.dep.jython2.2" />
<javac srcdir="build/src-main-java-filtered" destdir="build/classes" deprecation="off"
debug="on" optimize="off" target="1.7" source="1.7" encoding="utf-8"
debug="on" optimize="off" target="17" source="17" encoding="utf-8"
includeantruntime="false"
classpathref="ivy.dep.jython2.2"
bootclasspath="${boot.classpath.j2se1.7}"
executable="${java.home.17}/bin/javac"
includes="
freemarker/ext/jython/_Jython22VersionAdapter.java"
/>

<ivy:cachepath conf="build.jython2.5" pathid="ivy.dep.jython2.5" />
<ivy:cachepath conf="build.jython2.7" pathid="ivy.dep.jython2.7" />
<javac srcdir="build/src-main-java-filtered" destdir="build/classes" deprecation="off"
debug="on" optimize="off" target="1.7" source="1.7" encoding="utf-8"
debug="on" optimize="off" target="17" source="17" encoding="utf-8"
includeantruntime="false"
classpathref="ivy.dep.jython2.5"
bootclasspath="${boot.classpath.j2se1.7}"
classpathref="ivy.dep.jython2.7"
executable="${java.home.17}/bin/javac"
includes="
freemarker/ext/jython/_Jython25VersionAdapter.java"
/>

<rmic base="build/classes" classpathref="ivy.dep"
includes="build/src-main-java-filtered/freemarker/debug/impl/Rmi*Impl.class"
verify="yes" stubversion="1.2"
/>

<copy toDir="build/classes">
<fileset dir="src/main/resources"
excludes="
Expand All @@ -362,11 +334,11 @@

<ivy:cachepath conf="build.test" pathid="ivy.dep.build.test" />
<javac srcdir="src/test/java" destdir="build/test-classes" deprecation="off"
debug="on" optimize="off" target="1.8" source="1.8" encoding="utf-8"
debug="on" optimize="off" target="17" source="17" encoding="utf-8"
includeantruntime="false"
classpath="build/classes"
classpathref="ivy.dep.build.test"
bootclasspath="${boot.classpath.j2se1.8}"
executable="${java.home.17}/bin/javac"
/>
<copy toDir="build/test-classes">
<fileset dir="src/test/resources"
Expand Down Expand Up @@ -1018,8 +990,6 @@ Proceed? </input>
</filterchain>
</copy>



</target>

<!-- ================================================================== -->
Expand Down
Loading