You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2021/08/31 19:01:00 UTC
[maven-javadoc-plugin] 01/01: [MJAVADOC-450] Artifacts with a
classifier are ignored when looking for resources in dependencies
This is an automated email from the ASF dual-hosted git repository.
rfscholte pushed a commit to branch MJAVADOC-450
in repository https://gitbox.apache.org/repos/asf/maven-javadoc-plugin.git
commit 7b7813e5ee6ba59ba75701c4d689337865bdc1f1
Author: rfscholte <rf...@apache.org>
AuthorDate: Tue Aug 31 21:00:46 2021 +0200
[MJAVADOC-450] Artifacts with a classifier are ignored when looking for resources in dependencies
---
.gitignore | 1 +
pom.xml | 2 +-
.../repository/mjavadoc450-static.jar/custom.css | 20 ++++++++
src/it/mrm/repository/mjavadoc450.pom | 28 ++++++++++
.../MJAVADOC-450_classifier/invoker.properties | 18 +++++++
src/it/projects/MJAVADOC-450_classifier/pom.xml | 60 ++++++++++++++++++++++
.../src/main/java/com/foo/MyClass.java | 26 ++++++++++
.../projects/MJAVADOC-450_classifier/verify.groovy | 24 +++++++++
.../maven/plugins/javadoc/AbstractJavadocMojo.java | 12 +++--
src/main/mdo/javadocOptions.mdo | 7 +++
10 files changed, 192 insertions(+), 6 deletions(-)
diff --git a/.gitignore b/.gitignore
index bdbdf67..b3f1b40 100644
--- a/.gitignore
+++ b/.gitignore
@@ -16,3 +16,4 @@ out/
/javadoc-options-javadoc-resources.xml
.checkstyle
/src/it/mrm/3rdparty/_doclet-1.0.jar
+/src/it/mrm/repository/_mjavadoc450-static.jar
diff --git a/pom.xml b/pom.xml
index c559ad8..7755ea5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -430,7 +430,7 @@ under the License.
</execution>
</executions>
<configuration>
- <version>1.1.0</version>
+ <version>1.1.1</version>
<models>
<model>src/main/mdo/javadocOptions.mdo</model>
</models>
diff --git a/src/it/mrm/repository/mjavadoc450-static.jar/custom.css b/src/it/mrm/repository/mjavadoc450-static.jar/custom.css
new file mode 100644
index 0000000..35d1e7c
--- /dev/null
+++ b/src/it/mrm/repository/mjavadoc450-static.jar/custom.css
@@ -0,0 +1,20 @@
+/*
+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.
+*/
+
+/* CUSTOM CSS */
diff --git a/src/it/mrm/repository/mjavadoc450.pom b/src/it/mrm/repository/mjavadoc450.pom
new file mode 100644
index 0000000..f0b7b15
--- /dev/null
+++ b/src/it/mrm/repository/mjavadoc450.pom
@@ -0,0 +1,28 @@
+<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugins.javadoc.its</groupId>
+ <artifactId>mjavadoc450</artifactId>
+ <version>1.0</version>
+ <packaging>war</packaging>
+
+</project>
diff --git a/src/it/projects/MJAVADOC-450_classifier/invoker.properties b/src/it/projects/MJAVADOC-450_classifier/invoker.properties
new file mode 100644
index 0000000..01043a9
--- /dev/null
+++ b/src/it/projects/MJAVADOC-450_classifier/invoker.properties
@@ -0,0 +1,18 @@
+# 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=javadoc:javadoc
diff --git a/src/it/projects/MJAVADOC-450_classifier/pom.xml b/src/it/projects/MJAVADOC-450_classifier/pom.xml
new file mode 100644
index 0000000..c0f324e
--- /dev/null
+++ b/src/it/projects/MJAVADOC-450_classifier/pom.xml
@@ -0,0 +1,60 @@
+<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.plugins.maven-javadoc-plugin.it</groupId>
+ <artifactId>mjavadoc450</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+
+ <url>https://issues.apache.org/jira/browse/MJAVADOC-450</url>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <maven.compiler.source>@maven.compiler.source@</maven.compiler.source>
+ <maven.compiler.target>@maven.compiler.target@</maven.compiler.target>
+ </properties>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>@project.version@</version>
+ <configuration>
+ <stylesheetfile>custom.css</stylesheetfile>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.plugins.javadoc.its</groupId>
+ <artifactId>mjavadoc450</artifactId>
+ <version>1.0</version>
+ <classifier>static</classifier>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+</project>
diff --git a/src/it/projects/MJAVADOC-450_classifier/src/main/java/com/foo/MyClass.java b/src/it/projects/MJAVADOC-450_classifier/src/main/java/com/foo/MyClass.java
new file mode 100644
index 0000000..385265d
--- /dev/null
+++ b/src/it/projects/MJAVADOC-450_classifier/src/main/java/com/foo/MyClass.java
@@ -0,0 +1,26 @@
+package com.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.
+ */
+
+import java.util.Arrays;
+
+public class MyClass
+{
+}
diff --git a/src/it/projects/MJAVADOC-450_classifier/verify.groovy b/src/it/projects/MJAVADOC-450_classifier/verify.groovy
new file mode 100644
index 0000000..ac751d0
--- /dev/null
+++ b/src/it/projects/MJAVADOC-450_classifier/verify.groovy
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+
+def buildLog = new File( basedir, 'build.log' );
+assert buildLog.text.contains('[DEBUG] custom.css found in javadoc plugin dependencies.')
+
+def stylesheetCss = new File( basedir, 'target/site/apidocs/stylesheet.css' );
+assert stylesheetCss.text.contains('/* CUSTOM CSS */')
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 db5198c..2168e5e 100644
--- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
+++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java
@@ -3813,6 +3813,7 @@ public abstract class AbstractJavadocMojo
coordinate.setGroupId( javadocArtifact.getGroupId() );
coordinate.setArtifactId( javadocArtifact.getArtifactId() );
coordinate.setVersion( javadocArtifact.getVersion() );
+ coordinate.setClassifier( javadocArtifact.getClassifier() );
return artifactResolver.resolveArtifact( getProjectBuildingRequest( project ), coordinate ).getArtifact();
}
@@ -6252,14 +6253,15 @@ public abstract class AbstractJavadocMojo
List<Dependency> dependencies = javadocPlugin.getDependencies();
for ( Dependency dependency : dependencies )
{
- JavadocPathArtifact javadocPathArtifact = new JavadocPathArtifact();
- javadocPathArtifact.setGroupId( dependency.getGroupId() );
- javadocPathArtifact.setArtifactId( dependency.getArtifactId() );
- javadocPathArtifact.setVersion( dependency.getVersion() );
+ ResourcesArtifact resourceArtifact = new ResourcesArtifact();
+ resourceArtifact.setGroupId( dependency.getGroupId() );
+ resourceArtifact.setArtifactId( dependency.getArtifactId() );
+ resourceArtifact.setVersion( dependency.getVersion() );
+ resourceArtifact.setClassifier( dependency.getClassifier() );
Artifact artifact = null;
try
{
- artifact = createAndResolveArtifact( javadocPathArtifact );
+ artifact = createAndResolveArtifact( resourceArtifact );
}
catch ( Exception e )
{
diff --git a/src/main/mdo/javadocOptions.mdo b/src/main/mdo/javadocOptions.mdo
index 3c50092..b61e527 100644
--- a/src/main/mdo/javadocOptions.mdo
+++ b/src/main/mdo/javadocOptions.mdo
@@ -290,6 +290,13 @@ under the License.
<type>String</type>
<identifier>true</identifier>
</field>
+ <field>
+ <name>classifier</name>
+ <description>The classifier of the artifact.</description>
+ <version>1.1.1+</version>
+ <type>String</type>
+ <identifier>true</identifier>
+ </field>
</fields>
</class>