diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml new file mode 100644 index 000000000..e6af043f8 --- /dev/null +++ b/.github/workflows/maven.yml @@ -0,0 +1,51 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Java CI + +on: [push, pull_request] + +# clear all permissions for GITHUB_TOKEN +permissions: {} + +jobs: + build: + + # execute on any push or pull request from forked repo + if: github.event_name == 'push' || ( github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork ) + + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + jdk: [8, 11, 17] + fail-fast: false + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + + - uses: actions/setup-java@v3 + with: + java-version: ${{ matrix.jdk }} + distribution: 'temurin' + cache: 'maven' + + - name: Build with Maven + run: mvn verify -e -B -V -ntp diff --git a/.gitignore b/.gitignore index 6a1796c7e..af6f434f6 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ # under the License. /.ivy/ +/.ant/ /.bin/ /build/ /build.properties diff --git a/ivysettings.xml b/ivysettings.xml index e54516eb8..742990be1 100644 --- a/ivysettings.xml +++ b/ivysettings.xml @@ -33,7 +33,7 @@ --> - + diff --git a/pom.xml b/pom.xml new file mode 100644 index 000000000..6ef3c7850 --- /dev/null +++ b/pom.xml @@ -0,0 +1,455 @@ + + + + 4.0.0 + + + + org.apache + apache + 30 + + + org.apache.freemarker + freemarker + 2.3.33-SNAPSHOT + jar + + Apache Freemarker + + FreeMarker is a "template engine"; a generic tool to + generate text output (anything from HTML to autogenerated source + code) based on templates. + https://freemarker.apache.org/ + 2000 + + + + 8 + 1.${javaVersion} + 1.${javaVersion} + ${user.home}/maven-sites + true + ParameterNumber,MethodLength,FileLength + 2023-06-12T17:56:47Z + 1.6.1 + + 7.6.21.v20160908 + 2.5.6.SEC03 + + + + + + + + javax.servlet + servlet-api + 2.5 + + + javax.servlet.jsp + jsp-api + 2.1 + + + + + jaxen + jaxen + 1.0-FCS + + + saxpath + saxpath + 1.0-FCS + + + xalan + xalan + 2.7.0 + + + xml-apis + xml-apis + + + + + org.dom4j + dom4j + 2.1.3 + + + jdom + jdom + 1.0b8 + + + rhino + js + 1.6R1 + + + org.python + jython + 2.5.0 + + + org.zeroturnaround + javarebel-sdk + 1.2.2 + + + + + avalon-logkit + avalon-logkit + 2.0 + + + org.slf4j + slf4j-api + ${dependency.slf4j.version} + + + org.slf4j + log4j-over-slf4j + ${dependency.slf4j.version} + + + org.slf4j + jcl-over-slf4j + ${dependency.slf4j.version} + + + commons-logging + commons-logging + 1.1.1 + + + + + ant + ant + 1.6.5 + + + xml-apis + xml-apis + + + + + org.apache.freemarker.docgen + freemarker-docgen-ant + 0.0.2-SNAPSHOT + + + com.google.code.findbugs + annotations + 3.0.0 + provided + true + + + + + ch.qos.logback + logback-classic + 1.1.2 + test + + + org.junit + junit-bom + 5.10.0 + pom + import + + + com.google.guava + guava + 29.0-jre + test + + + commons-io + commons-io + 2.7 + test + + + commons-lang + commons-lang + 2.6 + test + + + commons-collections + commons-collections + 3.1 + test + + + + + org.springframework + spring-core + ${dependency.spring.version} + test + + + org.springframework + spring-test + ${dependency.spring.version} + test + + + + + + + + javax.servlet + servlet-api + + + javax.servlet.jsp + jsp-api + + + + + jaxen + jaxen + + + saxpath + saxpath + + + xalan + xalan + + + org.dom4j + dom4j + + + jdom + jdom + + + rhino + js + + + org.python + jython + + + org.zeroturnaround + javarebel-sdk + + + + + avalon-logkit + avalon-logkit + + + org.slf4j + slf4j-api + + + org.slf4j + log4j-over-slf4j + + + org.slf4j + jcl-over-slf4j + + + commons-logging + commons-logging + + + + + ant + ant + + + + com.google.code.findbugs + annotations + provided + true + + + + + ch.qos.logback + logback-classic + test + + + org.junit.vintage + junit-vintage-engine + test + + + org.hamcrest + hamcrest-library + 1.3 + test + + + com.google.guava + guava + test + + + commons-io + commons-io + test + + + commons-lang + commons-lang + test + + + commons-collections + commons-collections + 3.1 + test + + + + + org.eclipse.jetty + jetty-server + ${dependency.jetty.version} + test + + + org.eclipse.jetty + jetty-webapp + ${dependency.jetty.version} + test + + + org.eclipse.jetty + jetty-jsp + ${dependency.jetty.version} + test + + + org.eclipse.jetty + jetty-util + ${dependency.jetty.version} + test + + + + displaytag + displaytag + 1.2 + test + + + com.lowagie + itext + + + org.slf4j + * + + + log4j + log4j + + + + + + + org.springframework + spring-core + test + + + org.springframework + spring-test + test + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org.codehaus.mojo + javacc-maven-plugin + 3.0.1 + + + + + + + org.codehaus.mojo + javacc-maven-plugin + + + javacc + + javacc + + generate-sources + + + + + + + + + maven-compiler-release + + [9,] + + + ${javaVersion} + + + + + diff --git a/src/main/java/freemarker/ext/jsp/FreeMarkerJspFactory2.java b/src/main/java/freemarker/ext/jsp/FreeMarkerJspFactory2.java deleted file mode 100644 index 2eed561f4..000000000 --- a/src/main/java/freemarker/ext/jsp/FreeMarkerJspFactory2.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package freemarker.ext.jsp; - - -/** - */ -class FreeMarkerJspFactory2 extends FreeMarkerJspFactory { - @Override - protected String getSpecificationVersion() { - return "2.0"; - } -} \ No newline at end of file diff --git a/src/main/java/freemarker/ext/jsp/_FreeMarkerPageContext2.java b/src/main/java/freemarker/ext/jsp/_FreeMarkerPageContext2.java deleted file mode 100644 index d2fa19dcd..000000000 --- a/src/main/java/freemarker/ext/jsp/_FreeMarkerPageContext2.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package freemarker.ext.jsp; - -import java.io.IOException; - -import javax.servlet.ServletException; -import javax.servlet.jsp.JspFactory; -import javax.servlet.jsp.PageContext; -import javax.servlet.jsp.el.ELException; -import javax.servlet.jsp.el.ExpressionEvaluator; -import javax.servlet.jsp.el.VariableResolver; - -import freemarker.log.Logger; -import freemarker.template.TemplateModelException; - -/** - * Don't use this class; it's only public to work around Google App Engine Java - * compliance issues. FreeMarker developers only: treat this class as package-visible. - * - * Implementation of PageContext that contains JSP 2.0 specific methods. - */ -public class _FreeMarkerPageContext2 extends FreeMarkerPageContext { - private static final Logger LOG = Logger.getLogger("freemarker.jsp"); - - static { - if (JspFactory.getDefaultFactory() == null) { - JspFactory.setDefaultFactory(new FreeMarkerJspFactory2()); - } - LOG.debug("Using JspFactory implementation class " + - JspFactory.getDefaultFactory().getClass().getName()); - } - - public _FreeMarkerPageContext2() throws TemplateModelException { - super(); - } - - /** - * Attempts to locate and manufacture an expression evaulator instance. For this - * to work you must have the Apache Commons-EL package in the classpath. If - * Commons-EL is not available, this method will throw an UnsupportedOperationException. - */ - @Override - public ExpressionEvaluator getExpressionEvaluator() { - try { - Class type = Thread.currentThread().getContextClassLoader().loadClass - ("org.apache.commons.el.ExpressionEvaluatorImpl"); - return (ExpressionEvaluator) type.newInstance(); - } catch (Exception e) { - throw new UnsupportedOperationException("In order for the getExpressionEvaluator() " + - "method to work, you must have downloaded the apache commons-el jar and " + - "made it available in the classpath."); - } - } - - /** - * Returns a variable resolver that will resolve variables by searching through - * the page scope, request scope, session scope and application scope for an - * attribute with a matching name. - */ - @Override - public VariableResolver getVariableResolver() { - final PageContext ctx = this; - - return new VariableResolver() { - @Override - public Object resolveVariable(String name) throws ELException { - return ctx.findAttribute(name); - } - }; - } - - /** - * Includes the specified path. The flush argument is ignored! - */ - @Override - public void include(String path, boolean flush) throws IOException, ServletException { - super.include(path); - } -} diff --git a/src/main/java/freemarker/ext/jython/_Jython20And21VersionAdapter.java b/src/main/java/freemarker/ext/jython/_Jython20And21VersionAdapter.java deleted file mode 100644 index fe16dc023..000000000 --- a/src/main/java/freemarker/ext/jython/_Jython20And21VersionAdapter.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package freemarker.ext.jython; - -import org.python.core.PyJavaInstance; -import org.python.core.PyObject; - -/** - * Don't use this class; it's only public to work around Google App Engine Java - * compliance issues. FreeMarker developers only: treat this class as package-visible. - * - * {@link JythonVersionAdapter} for Jython 2.0 and 2.1. - */ -public class _Jython20And21VersionAdapter extends JythonVersionAdapter { - - @Override - public boolean isPyInstance(Object obj) { - return obj instanceof PyJavaInstance; - } - - @Override - public Object pyInstanceToJava(Object pyInstance) { - return ((PyJavaInstance) pyInstance).__tojava__(java.lang.Object.class); - } - - @Override - public String getPythonClassName(PyObject pyObject) { - return pyObject.__class__.__name__; - } - -} diff --git a/src/main/java/freemarker/ext/jython/_Jython22VersionAdapter.java b/src/main/java/freemarker/ext/jython/_Jython22VersionAdapter.java deleted file mode 100644 index 62f2e782c..000000000 --- a/src/main/java/freemarker/ext/jython/_Jython22VersionAdapter.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package freemarker.ext.jython; - -import org.python.core.PyJavaInstance; -import org.python.core.PyObject; - -/** - * Don't use this class; it's only public to work around Google App Engine Java - * compliance issues. FreeMarker developers only: treat this class as package-visible. - * - * {@link JythonVersionAdapter} for Jython 2.2. - */ -public class _Jython22VersionAdapter extends JythonVersionAdapter { - - @Override - public boolean isPyInstance(Object obj) { - return obj instanceof PyJavaInstance; - } - - @Override - public Object pyInstanceToJava(Object pyInstance) { - return ((PyJavaInstance) pyInstance).__tojava__(java.lang.Object.class); - } - - @Override - public String getPythonClassName(PyObject pyObject) { - return pyObject.getType().getFullName(); - } - -}