This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch MJAVADOC-672
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git

commit f3c6b4a2582b5c689af9e8fabaea0d647e3ce9c4
Author: rfscholte <[email protected]>
AuthorDate: Sat May 1 11:28:30 2021 +0200

    [MJAVADOC-672] misleading Exit code: 2 - javadoc: error - No source files 
for package
---
 .../MJAVADOC-672_multiline-tag/invoker.properties  | 17 ++++++
 src/it/projects/MJAVADOC-672_multiline-tag/pom.xml | 65 ++++++++++++++++++++++
 .../src/main/java/foo/Bar.java                     | 36 ++++++++++++
 .../maven/plugins/javadoc/AbstractJavadocMojo.java | 17 +++---
 4 files changed, 128 insertions(+), 7 deletions(-)

diff --git a/src/it/projects/MJAVADOC-672_multiline-tag/invoker.properties 
b/src/it/projects/MJAVADOC-672_multiline-tag/invoker.properties
new file mode 100644
index 0000000..7a948bb
--- /dev/null
+++ b/src/it/projects/MJAVADOC-672_multiline-tag/invoker.properties
@@ -0,0 +1,17 @@
+# 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.
+invoker.goals = compile javadoc:javadoc
diff --git a/src/it/projects/MJAVADOC-672_multiline-tag/pom.xml 
b/src/it/projects/MJAVADOC-672_multiline-tag/pom.xml
new file mode 100644
index 0000000..c8ed6a1
--- /dev/null
+++ b/src/it/projects/MJAVADOC-672_multiline-tag/pom.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ 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.
+  -->
+<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>foo</groupId>
+  <artifactId>bar</artifactId>
+  <version>0.1.0-SNAPSHOT</version>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <tags>
+            <tag>
+              <name>todo</name>
+              <placement>a</placement>
+              <head>what is to be done in the present code fragment;
+                jopas only</head>
+            </tag>
+            <tag>
+              <name>To.Do</name>
+              <placement>a</placement>
+              <head>ToDo: </head>
+            </tag>
+            <tag>
+              <name>Fix.Me</name>
+              <placement><![CDATA[<p>To all of you:
+               <strong>start fixing this!<strong></p>
+               Thank you
+              ]]></placement>
+              <head>ToDo: </head>
+            </tag>
+          </tags>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git 
a/src/it/projects/MJAVADOC-672_multiline-tag/src/main/java/foo/Bar.java 
b/src/it/projects/MJAVADOC-672_multiline-tag/src/main/java/foo/Bar.java
new file mode 100644
index 0000000..8bd0c90
--- /dev/null
+++ b/src/it/projects/MJAVADOC-672_multiline-tag/src/main/java/foo/Bar.java
@@ -0,0 +1,36 @@
+package foo;
+
+/*
+ * 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.
+ */
+
+/**
+ * Bar.
+ */
+public class Bar
+{
+
+    /**
+     * @todo FIXME
+     */
+    public void run()
+    {
+        System.out.println( "Bar" );
+    }
+
+}
diff --git 
a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java 
b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
index add99dd..1409241 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -5574,14 +5574,17 @@ public abstract class AbstractJavadocMojo
     private void addTags( List<String> arguments )
         throws MavenReportException
     {
-        Set<Tag> tags = collectTags();
-
-        if ( isEmpty( tags ) )
+        final String lineSeparator;
+        if ( javadocRuntimeVersion.isBefore( "9" ) )
         {
-            return;
+            lineSeparator = " ";
+        }
+        else
+        {
+            lineSeparator = " \\\\" + SystemUtils.LINE_SEPARATOR;
         }
 
-        for ( Tag tag : tags )
+        for ( Tag tag : collectTags() )
         {
             if ( StringUtils.isEmpty( tag.getName() ) )
             {
@@ -5595,10 +5598,10 @@ public abstract class AbstractJavadocMojo
                 String value = "\"" + tag.getName();
                 if ( StringUtils.isNotEmpty( tag.getPlacement() ) )
                 {
-                    value += ":" + tag.getPlacement();
+                    value += ":" + tag.getPlacement().replaceAll( "\\R", 
lineSeparator );
                     if ( StringUtils.isNotEmpty( tag.getHead() ) )
                     {
-                        value += ":" + tag.getHead();
+                        value += ":" + tag.getHead().replaceAll( "\\R", 
lineSeparator );
                     }
                 }
                 value += "\"";

Reply via email to