[
https://issues.apache.org/jira/browse/MJAVADOC-481?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16029488#comment-16029488
]
Lukas Eder commented on MJAVADOC-481:
-------------------------------------
I'm running into the same issue and for the same reasons: Adding Google
Analytics code to all Javadoc, which I've put inside the {{<header>}} element.
My workaround: Postprocessing. This seems to work:
{code:xml}
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
...
</plugin>
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<version>1.5.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<basedir>${project.build.directory}/apidocs</basedir>
<includes>
<include>**/*.html</include>
</includes>
<replacements>
<replacement>
<token><![CDATA[<body>]]></token>
<value><![CDATA[<body>
<script type="text/javascript">
...
</script>
]]></value>
</replacement>
</replacements>
</configuration>
</plugin>
{code}
> Java 1.8.0_u121 allow-script-in-comments
> ----------------------------------------
>
> Key: MJAVADOC-481
> URL: https://issues.apache.org/jira/browse/MJAVADOC-481
> Project: Maven Javadoc Plugin
> Issue Type: Improvement
> Components: javadoc
> Affects Versions: 2.10.4
> Reporter: Stephen Colebourne
>
> In its infinite wisdom, Oracle added a new command line flag in the standard
> doclet in JDK 8 update release 1.8.0_u121. By default, they now reject any
> script tags in headers and footers. An example use for these would be to add
> Google Analytics to the footer of each page of Javadoc. For example [see
> here|https://github.com/OpenGamma/Strata/blob/9712d78bec9f441024c30e9216e9b243fe679e2b/modules/pom.xml#L645]
>
> The rejection of scripts can be turned off using "--allow-script-in-comments"
> (note the double hyphen). The new flag can only be added to javadoc in
> 1.8.0u121 or later. If the flag is added to "additionalparam" and used on
> earlier releases of JDK 8, it will complain that it is an unrecognised flag.
> Sadly, this does not work:
> {code}
> <profile>
> <activation>
> <jdk>[1.8.0.121,]</jdk>
> </activation>
> <properties>
> <additionalparam>--allow-script-in-comments</additionalparam>
> </properties>
> </profile>
> {code}
> As such, this needs to be exposed as a flag in Maven to provide a way to
> create a Maven pom.xml that is valid for all JDK 8 releases.
> Thread complaining about the lack of release notes:
> http://mail.openjdk.java.net/pipermail/javadoc-dev/2017-January/thread.html
> Issue in Gradle: https://github.com/gradle/gradle/issues/1393
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)