{"id":13821594,"url":"https://github.com/apache/freemarker","last_synced_at":"2025-05-14T15:11:37.436Z","repository":{"id":1952350,"uuid":"41902290","full_name":"apache/freemarker","owner":"apache","description":"Apache Freemarker","archived":false,"fork":false,"pushed_at":"2025-03-11T10:58:36.000Z","size":24105,"stargazers_count":1020,"open_issues_count":5,"forks_count":271,"subscribers_count":44,"default_branch":"2.3-gae","last_synced_at":"2025-04-12T01:53:03.959Z","etag":null,"topics":["freemarker"],"latest_commit_sha":null,"homepage":"https://freemarker.apache.org/","language":"Java","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apache.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-09-04T07:00:05.000Z","updated_at":"2025-04-07T09:53:26.000Z","dependencies_parsed_at":"2023-12-25T19:59:34.993Z","dependency_job_id":"67c7059d-055b-492a-90c1-239c836b4436","html_url":"https://github.com/apache/freemarker","commit_stats":{"total_commits":2467,"total_committers":46,"mean_commits":"53.630434782608695","dds":0.06647750304012967,"last_synced_commit":"f2b4844edc5b7ceb12d839bff84733ad944139b1"},"previous_names":[],"tags_count":48,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Ffreemarker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Ffreemarker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Ffreemarker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Ffreemarker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apache","download_url":"https://codeload.github.com/apache/freemarker/tar.gz/refs/heads/2.3-gae","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248505873,"owners_count":21115354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["freemarker"],"created_at":"2024-08-04T08:01:24.428Z","updated_at":"2025-04-12T01:53:09.748Z","avatar_url":"https://github.com/apache.png","language":"Java","funding_links":[],"categories":["Java","模板引擎"],"sub_categories":[],"readme":"Apache FreeMarker™ {version}\n============================\n\n[![Build status](https://github.com/apache/freemarker/actions/workflows/ci.yml/badge.svg)](https://github.com/apache/freemarker/actions/workflows/ci.yml)\n\nFor the latest version or to report bugs visit:\nhttps://freemarker.apache.org/\n\n\nRegarding pull requests on Github\n---------------------------------\n\nBy sending a pull request you grant the Apache Software Foundation\nsufficient rights to use and release the submitted work under the\nApache license. You grant the same rights (copyright license, patent\nlicense, etc.) to the Apache Software Foundation as if you have signed\na [Contributor License Agreement](https://www.apache.org/dev/new-committers-guide.html#cla).\nFor contributions that are judged to be non-trivial, you will be asked\nto actually signing a Contributor License Agreement.\n\n\nWhat is Apache FreeMarker™?\n---------------------------\n\nApache FreeMarker™ is a \"template engine\"; a generic tool to generate\ntext output (anything from HTML to auto generated source code) based on\ntemplates. It's a Java package, a class library for Java programmers.\nIt's not an application for end-users in itself, but something that\nprogrammers can embed into their products. FreeMarker is designed to\nbe practical for the generation of HTML Web pages, particularly by\nservlet-based applications following the MVC (Model View Controller)\npattern.\n\n\nLicensing\n---------\n\nFreeMarker is licensed under the Apache License, Version 2.0.\n\nSee the `LICENSE` file for more details!\n\n\nDocumentation\n-------------\n\nOnline: https://freemarker.apache.org/docs/\n\nOffline: The full documentation is available in the binary distribution\nin the documentation/index.html directory.\n\n\nInstalling\n----------\n\nIf you are using Maven, just add this dependency:\n\n```xml\n  \u003c!--\n  Attention: Be sure nothing pulls in an old dependency with groupId\n  \"freemarker\" (without the \"org.\"), because then you will end up with\n  two freemarker.jar-s and unpredictable behavior on runtime!\n  --\u003e\n  \u003cdependency\u003e\n    \u003cgroupId\u003eorg.freemarker\u003c/groupId\u003e\n    \u003cartifactId\u003efreemarker-gae\u003c/artifactId\u003e\n    \u003cversion\u003e{version}\u003c/version\u003e\n  \u003c/dependency\u003e\n```\n\nOtherwise, simply copy `freemarker.jar` to a location where your Java\napplication's `ClassLoader` will find it. For example, if you are using\nFreeMarker in a web application, you probably want to put\n`freemarker.jar` into the `WEB-INF/lib` directory of your web application.\n\nFreeMarker has no required dependencies. It has several optional\ndependencies, but usually you don't have to deal with them, because if\nyou are using an optional feature that's certainly because your\napplication already uses the related library.\n\nAttention: If you upgrade to OpenJDK 9 or later, and you are using\nXPath queries in templates, you will need to add Apache Xalan as a\ndependency, as `freemarker.ext.dom` can't use the XPath support\nincluded in OpenJDK anymore. It's not needed on Oracle Java 9,\nor if FreeMarker is configured to use Jaxen for XPath.\n\nThe minimum required Java version is currently Java SE 8. (The presence\nof a later version is detected on runtime and utilized by FreeMarker\nautomatically.)\n\n\nChange log\n----------\n\nOnline (for stable releases only):\nhttps://freemarker.apache.org/docs/app_versions.html\n\nOffline:\nIn the binary release, open `documentation/index.html`, and you will find the\nlink.\n\n\nBuilding FreeMarker\n-------------------\n\nIf you haven't yet, download the source release, or checkout FreeMarker from\nthe source code repository. See repository locations here:\nhttps://freemarker.apache.org/sourcecode.html\n\nYou need JDK 8, JDK 16, and JDK 17 (only for some tests) to be installed\n(and [visible to Gradle](https://docs.gradle.org/current/userguide/toolchains.html)).\nThat's because different parts of the source code target different Java versions,\nand Gradle requires the exact JDK version (not higher) for each.\n\nBe sure that your default Java version (which Gradle should use automatically) is at\nleast 17!\n\nIf you are building from the official source *release* (not from source that you\ngot from Git), `gradle/wrapper/gradle-wrapper.jar` is missing from that, and you\nhave to add it yourself! You can download it\n[from GitHub source code page](https://github.com/apache/freemarker/tree/2.3-gae/gradle/wrapper)!\n(Or, use your own Gradle installation instead of `gradlew`.)\n\nTo build `freemarker.jar`, just issue `./gradlew jar` (`gradlew.bat jar` on Windows) in the\nproject root directory, and it should download all dependencies automatically, and build\n`freemarker.jar`.\n\nTo run all JUnit tests and some other checks, issue `./gradlew check`. (Avoid the\n`test` task, as that will only run the tests of the `core` source set.)\n\nTo generate documentation, issue `./gradlew javadoc` and `./gradlew manualOffline`.\n\nTo build the distribution artifacts (the `tgz`-s that people can download), run `./gradlew build`. However,\nfor a stable (non-`SNAPSHOT`) version number, you must set up signing, or disable that verification\nwith `freemarker.allowUnsignedReleaseBuild=true`; see `gradle.properties` in this project for those!\n\nReproducible builds: If the resulting `freemarker.jar` is not identical with the official jar, see the build environment\nin the `.buildinfo` file packed into the official source distribution, and also into the Maven \"sources\" artifact! At\nleast with identical Java versions, the resulting `freemarker.jar` meant to match exactly.\n\nNote on trying things out with an ad-hoc class that has `main` method: Don't do that, instead write it as a JUnit test.\nFreeMarker needs to be loaded from `freemarker.jar` that contains the `META-INF/versions` directory (as per JEP 238,\nMulti-Release JAR Files). If you run a test, Gradle ensures that you have an up-to-date `freemarker.jar`, and\nthat it's in the classpath. Without that, FreeMarker will behave as if you are on a lower Java version.\n\n\n### Maven-related build tasks\n\nTo see how the project would be deployed to Maven Central, issue\n`./gradlew publishAllPublicationsToLocalRepository`,\nand check the `build/local-deployment` directory.\n \nTo publish to the Apache Maven Repository (from where you can also promote releases to the Maven Central Repository)\nissue `.\\gradlew publish`. Note that for this the following Gradle properties must be properly set\n(in `gradle.properties`, or pass them via `-P\u003cname\u003e=\u003cvalue\u003e` arguments):\n`freemarker.signMethod`, `freemarker.deploy.apache.user`, `freemarker.deploy.apache.password`.\n\n\n\nIDE setup\n---------\n\n### IntelliJ IDEA\n\nOriginally done on IntelliJ IDEA Community 2023.3.2:\n\n- \"File\" -\u003e \"Open\": Select the \"settings.gradle.kts\" within the freemarker root directory.\n- If the project fails to load (or build), then adjust the following configuration\n  in \"File\" -\u003e \"Settings\" -\u003e \"Build, Execution, Deployment\" -\u003e \"Build Tools\" -\u003e \"Gradle\":\n  - Gradle JVM: JDK 17 (or higher)\n  - Build and run using: \"Gradle\"\n  - Run tests using: \"Gradle\"\n\n- \"File\" -\u003e \"Settings\"\n  - Under \"Editor\" / \"Code style\", import and use\n    freemarker/src/ide-settings/IntelliJ-IDEA/Java-code-style-FreeMarker.xml\n  - Under \"Editor\" / \"Inspections\", import and use\n    freemarker/src/ide-settings/IntelliJ-IDEA/Editor-Inspections-FreeMarker.xml\n  - Copy the copyright header comment from some of the java files, then\n    under \"Editor\" / \"Copyright\" / \"Copyright Profiles\" click \"+\", enter \"ASL2\" as name,\n    then paste the copyright header. Delete the `/*` and ` */` lines, and the ` *`\n    prefixes (to select columns of text, hold Alt while selecting with the mouse.) Then\n    go back to \"Copyright\" in the tree, and set \"Default project copyright\" to \"ASL2\".\n\n### Eclipse\n\nThis section wasn't updated long ago. But you should import the project as any other\nGradle project. After that, it's recommended to set these preferences (based on Eclipse Mars):\n\n- Window -\u003e Preferences\n  - General -\u003e Workspace, set the text file encoding\n    to \"UTF-8\". (Or, you can set the same later on project level instead.)\n  - General -\u003e Editors -\u003e Text Editors, set:\n    - Insert space for tabs\n    - Show print margin, 120 columns\n  - Java -\u003e Code Style -\u003e Formatter -\u003e Import...\n    Select src\\ide-settings\\Eclipse\\Formatter-profile-FreeMarker.xml\n    inside the FreeMarker project directory.\n    (On IntelliJ IDEA, import\n    src/ide-settings/IntelliJ-IDEA/Java-code-style-FreeMarker.xml instead)\n    This profile uses space-only indentation policy and 120 character line\n    width, and formatting rules that are pretty much standard in modern Java.\n  - Java -\u003e Code Style -\u003e Organize imports\n    (On IntelliJ IDEA, this was already configured by the Java code style\n    import earlier.)\n    The order is this (the Eclipse default): java, javax, org, com.\n    Number of imports required for .*: 99\n    Number of static imports needed for .*: 1\n  - Java -\u003e Installed JRE-s:\n    Ensure that you have JDK 17 installed, and that it was added to Eclipse.\n    Note that it's not JRE, but JDK.\n  - Java -\u003e Compiler -\u003e Javadoc:\n    \"Malformed Javadoc comments\": Error\n    \"Only consider members as visible\": Private\n    \"Validate tag arguments\": true\n    \"Missing tag descriptions\": Validate @return tags\n    \"Missing Javadoc tags\": Ignore\n    \"Missing Javadoc comments\": Ignore\n- Import the project as any other Gradle project.\n- Eclipse will indicate many errors at this point; it's expected, read on.\n- Project -\u003e Properties -\u003e Java Compiler\n  - In Errors/Warnings, check in \"Enable project specific settings\", then set\n    \"Forbidden reference (access rules)\" from \"Error\" to \"Warning\".\n- At Project -\u003e Properties -\u003e Java Code Style -\u003e Formatter, check in \"Enable\n  project specific settings\", and then select \"FreeMarker\" as active profile.\n- At Project -\u003e Properties -\u003e Java Editor -\u003e Save Actions, check \"Enable project\n  specific settings\", then \"Perform the selected actions on save\", and have\n  only \"Organize imports\" and \"Additional actions\" checked (the list for the\n  last should contain \"Add missing @Override annotations\",\n  \"Add missing @Override annotations to implementations of interface methods\",\n  \"Add missing @Deprecated annotations\", and \"Remove unnecessary cast\").\n- Right-click on the project -\u003e Run As -\u003e JUnit Test\n  It should run without problems (all green).\n- It's highly recommended to use the Eclipse FindBugs plugin.\n  - Install it from Eclipse Marketplace (3.0.1 as of this writing)\n  - Window -\u003e Preferences -\u003e Java -\u003e FindBugs:\n    Set all bug marker ranks from Warning to Error. (For false alarms we add\n    @SuppressFBWarnings(value = \"...\", justification = \"...\") annotations.)\n  - Project -\u003e Properties -\u003e FindBugs -\u003e [x] Run Automatically\n  - There should 0 errors. But sometimes the plugin fails to take the\n    @SuppressFBWarnings annotations into account; then use Project -\u003e Clean. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Ffreemarker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapache%2Ffreemarker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Ffreemarker/lists"}