Skip to content

Commit

Permalink
[MJAVADOC-450] Artifacts with a classifier are ignored when looking f…
Browse files Browse the repository at this point in the history
…or resources in dependencies
  • Loading branch information
rfscholte committed Aug 31, 2021
1 parent 0d0e0cc commit 7b7813e
Show file tree
Hide file tree
Showing 10 changed files with 192 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
20 changes: 20 additions & 0 deletions src/it/mrm/repository/mjavadoc450-static.jar/custom.css
Original file line number Diff line number Diff line change
@@ -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 */
28 changes: 28 additions & 0 deletions src/it/mrm/repository/mjavadoc450.pom
Original file line number Diff line number Diff line change
@@ -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>
18 changes: 18 additions & 0 deletions src/it/projects/MJAVADOC-450_classifier/invoker.properties
Original file line number Diff line number Diff line change
@@ -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
60 changes: 60 additions & 0 deletions src/it/projects/MJAVADOC-450_classifier/pom.xml
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -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
{
}
24 changes: 24 additions & 0 deletions src/it/projects/MJAVADOC-450_classifier/verify.groovy
Original file line number Diff line number Diff line change
@@ -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 */')
Original file line number Diff line number Diff line change
Expand Up @@ -3813,6 +3813,7 @@ private Artifact createAndResolveArtifact( JavadocPathArtifact javadocArtifact )
coordinate.setGroupId( javadocArtifact.getGroupId() );
coordinate.setArtifactId( javadocArtifact.getArtifactId() );
coordinate.setVersion( javadocArtifact.getVersion() );
coordinate.setClassifier( javadocArtifact.getClassifier() );

return artifactResolver.resolveArtifact( getProjectBuildingRequest( project ), coordinate ).getArtifact();
}
Expand Down Expand Up @@ -6252,14 +6253,15 @@ private Optional<File> getResource( File outputFile, String inputResourceName )
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 )
{
Expand Down
7 changes: 7 additions & 0 deletions src/main/mdo/javadocOptions.mdo
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down

0 comments on commit 7b7813e

Please sign in to comment.