- You need JDK 8, JDK 16, and JDK 17 (only for some tests) to be installed, in a way so that Gradle will find these.
freemarker-* directories (if not otherwise noted below): The source sets of the main jar artifact. The FreeMarker
project is a single Gradle project that produces a single monolithic jar file (freemarker.jar). But the source code
is divided into multiple source sets, to allow using different Java versions and dependencies for compiling each. All
the resulting class files go into the final single jar file.
freemarker-manual contains the FreeMarker Manual (XDocBook and Docgen configuration), and doesn't contribute to
freemarker.jar or to the test suite.
freemarker-test-graalvm-native contains an isolated Gradle project for basic testing of FreeMarker when used
in a GraalVM native image. It doesn't contribute to freemarker.jar; it is only used for testing.
src/dist contains files needed for release distribution artifacts, and doesn't contribute to freemarker.jar or to
the test suite.
odgi.bnd is used for generating the OSGi metadata that goes into freemarker.jar.
rat-excludes is used for Apache RAT license check, which is only relevant when building a distribution artifact.
Always use the Gradle wrapper script (./gradlew or gradlew.bat) in the project root directory, not other Gradle
installation.
-
To run all JUnit tests and some other checks, run the
checktask (./gradlew check), not thetesttask, because thetesttask only runs the tests of thecoresource set! -
To run JUnit tests selectively, first consider which source set it is in.
- If it's in
freemarker-core, then run thetesttask with the optional--testsswitch, like this:./gradlew :test --tests "freemarker.core.ASTTest" - If it's in another source set, you cannot use the
testtask; instead, you must deduce a camel case test task name from the source set directory name. For example:- To test source set
freemarker-core16:./gradlew :core16Test - To test source set
freemarker-javax-servlet:./gradlew :javaxServletTest - And so on for the other source sets.
The
--testsswitch is supported by these tasks too, for example:./gradlew :core16Test --tests "freemarker.ext.beans.NotExportedInternalPackageTest"
- To test source set
- If it's in
-
To check if the documentation builds successfully:
- Generate HTML API documentation from the Java source code: Run the
javadoctask (./gradlew javadoc) - Generate HTML from
book.xml(FreeMarker Manual): Run themanualOfflinetask (./gradlew manualOffline)
- Generate HTML API documentation from the Java source code: Run the
-
To build
freemarker.jar, run thejartask (./gradlew jar) -
To check if the distribution artifacts can be built successfully (includes tests, jar, all documentation, Rat checks), run the
buildtask (./gradlew build).
-
The default (main) development branch is
2.3-gae; target that branch for pull requests. -
The code must be compatible with Java 8. However, modules like
freemarker-core<version>can use Java<version>(e.g.,freemarker-core16can use Java 16). -
Take backward compatibility seriously! Behavioral changes that realistically break existing applications must be opt-in (inactive by default) via a
ConfigurationorConfigurablesetting. If the changed behavior is preferable for new projects and is not highly incompatible, settingincompatibleImprovementsto the next release version should enable it by default, and that must be documented in the JavaDoc of theConfiguration(Version)constructor. -
Add JavaDoc to things whose purpose is not obvious, or where there are edge cases to explain. But never add JavaDoc that doesn't add helpful information (like
@param file The fileis not helpful, so just omit that@param). -
Always add a
@sincetag to public types and members you add. -
Add good JUnit test coverage to the new code.
See SECURITY.md for details.