From 5ec934e8ea0622c4b5daa7ebef2e7b34c5bfefdf Mon Sep 17 00:00:00 2001 From: Jaroslav Tulach Date: Sun, 11 Oct 2026 08:48:10 +0200 Subject: [PATCH] Allow ant javadoc on JDK25+ --- .github/workflows/main.yml | 1 - README.md | 2 +- .../org/netbeans/nbbuild/SysProperty.java | 50 +++++++++++++++++++ nbbuild/default.xml | 3 ++ nbbuild/templates/projectized.xml | 1 + 5 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 nbbuild/antsrc/org/netbeans/nbbuild/SysProperty.java diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3a82021b3d9e..0f831d5b644c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -468,7 +468,6 @@ jobs: - name: Build javadoc if: env.test_javadoc == 'true' && success() run: | - export ANT_OPTS=-Djdk.xml.totalEntitySizeLimit=200000 ant $OPTS -Djavadoc.fail.broken.links=true build-javadoc - name: Create Test Summary diff --git a/README.md b/README.md index 45e92d3bb0b9..2858441659b4 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ $ ant javadoc ``` #### Notes: -* On JDK 24 or later, building javadoc may require to raise the jaxp entity limit by setting `export ANT_OPTS=-Djdk.xml.totalEntitySizeLimit=200000` + * Run `javadoc-nb` task in Netbeans to run the javadoc build and display it in a web browser. ### Running NetBeans diff --git a/nbbuild/antsrc/org/netbeans/nbbuild/SysProperty.java b/nbbuild/antsrc/org/netbeans/nbbuild/SysProperty.java new file mode 100644 index 000000000000..06052e1c94e6 --- /dev/null +++ b/nbbuild/antsrc/org/netbeans/nbbuild/SysProperty.java @@ -0,0 +1,50 @@ +/* + * 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 org.netbeans.nbbuild; + +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.Task; + +/** Sets a system property in the running JVM. Use with care. Needed to + * increase XML entities parsing limit before processing out Javadoc with + * {@code }. + */ +public final class SysProperty extends Task { + private String name; + private String value; + + public void setProperty(String name) { + this.name = name; + } + + public void setValue(String value) { + this.value = value; + } + + @Override + public void execute() throws BuildException { + String current = System.getProperty(name); + if (current == null) { + System.setProperty(name, value); + } else { + getProject().log(this, "Not setting property " + name + " as it already has a value " + current, Project.MSG_WARN); + } + } +} diff --git a/nbbuild/default.xml b/nbbuild/default.xml index f72c31f2b2d3..cb93b6f589cc 100644 --- a/nbbuild/default.xml +++ b/nbbuild/default.xml @@ -116,6 +116,9 @@ + diff --git a/nbbuild/templates/projectized.xml b/nbbuild/templates/projectized.xml index 56a3a700cd19..0be30f48c245 100644 --- a/nbbuild/templates/projectized.xml +++ b/nbbuild/templates/projectized.xml @@ -405,6 +405,7 @@ +