Skip to content

Commit 7b7813e

Browse files
committed
[MJAVADOC-450] Artifacts with a classifier are ignored when looking for resources in dependencies
1 parent 0d0e0cc commit 7b7813e

File tree

10 files changed

+192
-6
lines changed

10 files changed

+192
-6
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ out/
1616
/javadoc-options-javadoc-resources.xml
1717
.checkstyle
1818
/src/it/mrm/3rdparty/_doclet-1.0.jar
19+
/src/it/mrm/repository/_mjavadoc450-static.jar

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ under the License.
430430
</execution>
431431
</executions>
432432
<configuration>
433-
<version>1.1.0</version>
433+
<version>1.1.1</version>
434434
<models>
435435
<model>src/main/mdo/javadocOptions.mdo</model>
436436
</models>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
*/
19+
20+
/* CUSTOM CSS */

src/it/mrm/repository/mjavadoc450.pom

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<!--
3+
Licensed to the Apache Software Foundation (ASF) under one
4+
or more contributor license agreements. See the NOTICE file
5+
distributed with this work for additional information
6+
regarding copyright ownership. The ASF licenses this file
7+
to you under the Apache License, Version 2.0 (the
8+
"License"); you may not use this file except in compliance
9+
with the License. You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing,
14+
software distributed under the License is distributed on an
15+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
KIND, either express or implied. See the License for the
17+
specific language governing permissions and limitations
18+
under the License.
19+
-->
20+
<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">
21+
<modelVersion>4.0.0</modelVersion>
22+
23+
<groupId>org.apache.maven.plugins.javadoc.its</groupId>
24+
<artifactId>mjavadoc450</artifactId>
25+
<version>1.0</version>
26+
<packaging>war</packaging>
27+
28+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
invoker.goals=javadoc:javadoc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!--
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
-->
21+
22+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
23+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
24+
<modelVersion>4.0.0</modelVersion>
25+
<groupId>org.apache.maven.plugins.maven-javadoc-plugin.it</groupId>
26+
<artifactId>mjavadoc450</artifactId>
27+
<version>1.0.0-SNAPSHOT</version>
28+
29+
<url>https://issues.apache.org/jira/browse/MJAVADOC-450</url>
30+
31+
<properties>
32+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
33+
<maven.compiler.source>@maven.compiler.source@</maven.compiler.source>
34+
<maven.compiler.target>@maven.compiler.target@</maven.compiler.target>
35+
</properties>
36+
37+
<build>
38+
<pluginManagement>
39+
<plugins>
40+
<plugin>
41+
<groupId>org.apache.maven.plugins</groupId>
42+
<artifactId>maven-javadoc-plugin</artifactId>
43+
<version>@project.version@</version>
44+
<configuration>
45+
<stylesheetfile>custom.css</stylesheetfile>
46+
</configuration>
47+
<dependencies>
48+
<dependency>
49+
<groupId>org.apache.maven.plugins.javadoc.its</groupId>
50+
<artifactId>mjavadoc450</artifactId>
51+
<version>1.0</version>
52+
<classifier>static</classifier>
53+
</dependency>
54+
</dependencies>
55+
</plugin>
56+
</plugins>
57+
</pluginManagement>
58+
</build>
59+
60+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.foo;
2+
3+
/*
4+
* Licensed to the Apache Software Foundation (ASF) under one
5+
* or more contributor license agreements. See the NOTICE file
6+
* distributed with this work for additional information
7+
* regarding copyright ownership. The ASF licenses this file
8+
* to you under the Apache License, Version 2.0 (the
9+
* "License"); you may not use this file except in compliance
10+
* with the License. You may obtain a copy of the License at
11+
*
12+
* http://www.apache.org/licenses/LICENSE-2.0
13+
*
14+
* Unless required by applicable law or agreed to in writing,
15+
* software distributed under the License is distributed on an
16+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
* KIND, either express or implied. See the License for the
18+
* specific language governing permissions and limitations
19+
* under the License.
20+
*/
21+
22+
import java.util.Arrays;
23+
24+
public class MyClass
25+
{
26+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
def buildLog = new File( basedir, 'build.log' );
21+
assert buildLog.text.contains('[DEBUG] custom.css found in javadoc plugin dependencies.')
22+
23+
def stylesheetCss = new File( basedir, 'target/site/apidocs/stylesheet.css' );
24+
assert stylesheetCss.text.contains('/* CUSTOM CSS */')

src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -3813,6 +3813,7 @@ private Artifact createAndResolveArtifact( JavadocPathArtifact javadocArtifact )
38133813
coordinate.setGroupId( javadocArtifact.getGroupId() );
38143814
coordinate.setArtifactId( javadocArtifact.getArtifactId() );
38153815
coordinate.setVersion( javadocArtifact.getVersion() );
3816+
coordinate.setClassifier( javadocArtifact.getClassifier() );
38163817

38173818
return artifactResolver.resolveArtifact( getProjectBuildingRequest( project ), coordinate ).getArtifact();
38183819
}
@@ -6252,14 +6253,15 @@ private Optional<File> getResource( File outputFile, String inputResourceName )
62526253
List<Dependency> dependencies = javadocPlugin.getDependencies();
62536254
for ( Dependency dependency : dependencies )
62546255
{
6255-
JavadocPathArtifact javadocPathArtifact = new JavadocPathArtifact();
6256-
javadocPathArtifact.setGroupId( dependency.getGroupId() );
6257-
javadocPathArtifact.setArtifactId( dependency.getArtifactId() );
6258-
javadocPathArtifact.setVersion( dependency.getVersion() );
6256+
ResourcesArtifact resourceArtifact = new ResourcesArtifact();
6257+
resourceArtifact.setGroupId( dependency.getGroupId() );
6258+
resourceArtifact.setArtifactId( dependency.getArtifactId() );
6259+
resourceArtifact.setVersion( dependency.getVersion() );
6260+
resourceArtifact.setClassifier( dependency.getClassifier() );
62596261
Artifact artifact = null;
62606262
try
62616263
{
6262-
artifact = createAndResolveArtifact( javadocPathArtifact );
6264+
artifact = createAndResolveArtifact( resourceArtifact );
62636265
}
62646266
catch ( Exception e )
62656267
{

src/main/mdo/javadocOptions.mdo

+7
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,13 @@ under the License.
290290
<type>String</type>
291291
<identifier>true</identifier>
292292
</field>
293+
<field>
294+
<name>classifier</name>
295+
<description>The classifier of the artifact.</description>
296+
<version>1.1.1+</version>
297+
<type>String</type>
298+
<identifier>true</identifier>
299+
</field>
293300
</fields>
294301
</class>
295302

0 commit comments

Comments
 (0)