diff --git a/.gitignore b/.gitignore index bdbdf6754..b3f1b40ac 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 c559ad8b3..7755ea5c1 100644 --- a/pom.xml +++ b/pom.xml @@ -430,7 +430,7 @@ under the License. - 1.1.0 + 1.1.1 src/main/mdo/javadocOptions.mdo 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 000000000..35d1e7c92 --- /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 000000000..f0b7b159e --- /dev/null +++ b/src/it/mrm/repository/mjavadoc450.pom @@ -0,0 +1,28 @@ + + + + 4.0.0 + + org.apache.maven.plugins.javadoc.its + mjavadoc450 + 1.0 + war + + 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 000000000..01043a9ec --- /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 000000000..c0f324e04 --- /dev/null +++ b/src/it/projects/MJAVADOC-450_classifier/pom.xml @@ -0,0 +1,60 @@ + + + + + + 4.0.0 + org.apache.maven.plugins.maven-javadoc-plugin.it + mjavadoc450 + 1.0.0-SNAPSHOT + + https://issues.apache.org/jira/browse/MJAVADOC-450 + + + UTF-8 + @maven.compiler.source@ + @maven.compiler.target@ + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + @project.version@ + + custom.css + + + + org.apache.maven.plugins.javadoc.its + mjavadoc450 + 1.0 + static + + + + + + + + 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 000000000..385265d97 --- /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 000000000..ac751d0fe --- /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 db5198c6b..2168e5e36 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 @@ 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(); } @@ -6252,14 +6253,15 @@ private Optional getResource( File outputFile, String inputResourceName ) List 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 3c500921b..b61e5274f 100644 --- a/src/main/mdo/javadocOptions.mdo +++ b/src/main/mdo/javadocOptions.mdo @@ -290,6 +290,13 @@ under the License. String true + + classifier + The classifier of the artifact. + 1.1.1+ + String + true +