You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Maven Site插件生成链接时特殊字符转义格式错误求助

Maven Site Plugin 链接特殊字符转义错误问题

使用Maven Site Plugin为项目编写文档时,发现链接中包含(这类特殊字符时,插件会将其错误转义为.28,而预期的正确转义应该是%28(对应)则被转义为.29,预期是%29)。

已尝试使用markdown、apt、xdoc及xhtml等多种源文件格式,也测试了3.12.1、3.7.1等旧版本插件,问题均未解决。

以下是相关文件内容:

XHTML输入文件

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
  <body>
  Test
  <a href="./apidocs/com.example.example/com/example/example/Test.html#function(java.lang.String)" >Link</a>
  </body>
</html>

pom.xml配置

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example.example</groupId>
    <artifactId>example</artifactId>
    <version>0.8.4</version>
    <name>Example</name>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.21.0</version>
            </plugin>
        </plugins>
    </build>
    
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-project-info-reports-plugin</artifactId>
                <version>3.8.0</version>
            </plugin>
        </plugins>
    </reporting>
</project>

生成的截断版HTML文件

<!DOCTYPE html>
<!--
 | Generated by Apache Maven Doxia Site Renderer 2.0.0 from src/site/xhtml/test.xhtml at 2025-01-06
 | Rendered using Apache Maven Fluido Skin 2.0.1
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="generator" content="Apache Maven Doxia Site Renderer 2.0.0" />
    <link rel="stylesheet" href="./css/apache-maven-fluido-2.0.1.min.css" />
    <link rel="stylesheet" href="./css/site.css" />
    <link rel="stylesheet" href="./css/print.css" media="print" />
    <script src="./js/apache-maven-fluido-2.0.1.min.js"></script>
  </head>
  <body>
    <div class="container-fluid container-fluid-top">
      <div class="row-fluid">
        <main id="bodyColumn" class="span10">
  Test
  <a href="./apidocs/com.example.example/com/example/example/Test.html#function.28java.lang.String.29">Link</a>
        </main>
      </div>
    </div>
  </body>
</html>

内容的提问来源于stack exchange,提问作者ASDFGamer

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.15 03:40:10