Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit f7476a5

Browse files
committed
[MJAVADOC-497] javadoc:aggregate ignores excludePackageNames
git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@1815669 13f79535-47bb-0310-9956-ffa450edef68
1 parent acf30c5 commit f7476a5

File tree

10 files changed

+299
-2
lines changed

10 files changed

+299
-2
lines changed

maven-javadoc-plugin/pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ under the License.
105105
<contributor>
106106
<name>Mark Raynsford</name>
107107
</contributor>
108+
<contributor>
109+
<name>Anton Klarén</name>
110+
</contributor>
108111
</contributors>
109112

110113
<dependencies>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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=clean javadoc:aggregate
19+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
23+
<modelVersion>4.0.0</modelVersion>
24+
25+
<parent>
26+
<groupId>org.apache.maven.plugins.maven-javadoc-plugin.it</groupId>
27+
<artifactId>mjavadoc497</artifactId>
28+
<version>1.0-SNAPSHOT</version>
29+
</parent>
30+
31+
<groupId>org.apache.maven.plugins.maven-javadoc-plugin.it</groupId>
32+
<artifactId>mjavadoc497-module1</artifactId>
33+
<version>1.0-SNAPSHOT</version>
34+
<name>Test MJAVADOC-497 Module 1</name>
35+
36+
</project>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.example.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+
/**
23+
* This is a Foo.
24+
*/
25+
public interface Foo
26+
{
27+
/**
28+
* Frobnicates the foo.
29+
*/
30+
public void frobnicate();
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package com.example.foo.impl;
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 com.example.foo.Foo;
23+
24+
/**
25+
* This is a FooImpl.
26+
*/
27+
public class FooImpl implements Foo
28+
{
29+
/**
30+
* Frobnicates the foo.
31+
*/
32+
public void frobnicate()
33+
{
34+
}
35+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
23+
<modelVersion>4.0.0</modelVersion>
24+
25+
<parent>
26+
<groupId>org.apache.maven.plugins.maven-javadoc-plugin.it</groupId>
27+
<artifactId>mjavadoc497</artifactId>
28+
<version>1.0-SNAPSHOT</version>
29+
</parent>
30+
31+
<groupId>org.apache.maven.plugins.maven-javadoc-plugin.it</groupId>
32+
<artifactId>mjavadoc497-module2</artifactId>
33+
<version>1.0-SNAPSHOT</version>
34+
<name>Test MJAVADOC-497 Module 2</name>
35+
36+
</project>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.example.bar;
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+
/**
23+
* This is a Bar.
24+
*/
25+
public class Bar
26+
{
27+
/**
28+
* Glibbifies the bar.
29+
*/
30+
public void glibbify()
31+
{
32+
}
33+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
23+
<modelVersion>4.0.0</modelVersion>
24+
25+
<groupId>org.apache.maven.plugins.maven-javadoc-plugin.it</groupId>
26+
<artifactId>mjavadoc497</artifactId>
27+
<packaging>pom</packaging>
28+
<version>1.0-SNAPSHOT</version>
29+
<name>Test MJAVADOC-497</name>
30+
31+
<modules>
32+
<module>module1</module>
33+
<module>module2</module>
34+
</modules>
35+
36+
<properties>
37+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
38+
</properties>
39+
40+
<build>
41+
<pluginManagement>
42+
<plugins>
43+
<plugin>
44+
<groupId>org.apache.maven.plugins</groupId>
45+
<artifactId>maven-javadoc-plugin</artifactId>
46+
<version>@pom.version@</version>
47+
<configuration>
48+
<subpackages>com.example.foo</subpackages>
49+
<excludePackageNames>*.impl.*</excludePackageNames>
50+
</configuration>
51+
</plugin>
52+
</plugins>
53+
</pluginManagement>
54+
</build>
55+
56+
</project>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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+
import java.io.*;
21+
22+
try
23+
{
24+
File packageList = new File( basedir, "target/site/apidocs/package-list" );
25+
if ( !packageList.exists() )
26+
{
27+
System.err.println( packageList + " is missing" );
28+
return false;
29+
}
30+
31+
FileReader fr = new FileReader( packageList );
32+
BufferedReader br = new BufferedReader( fr );
33+
String line = br.readLine();
34+
if ( !"com.example.foo".equals( line ) || br.readLine() != null )
35+
{
36+
System.err.println( "package com.example.foo is not the only entry in the package-list" );
37+
return false;
38+
}
39+
br.close();
40+
}
41+
catch ( Exception e )
42+
{
43+
e.printStackTrace();
44+
return false;
45+
}
46+
47+
return true;

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4699,8 +4699,6 @@ private void addJavadocOptions( List<String> arguments, List<String> sourcePaths
46994699
}
47004700
addArgIfNotEmpty( arguments, "-encoding", JavadocUtil.quotedArgument( getEncoding() ) );
47014701

4702-
addArgIfNotEmpty( arguments, "-exclude", getExcludedPackages( sourcePaths ), SINCE_JAVADOC_1_4 );
4703-
47044702
addArgIfNotEmpty( arguments, "-extdirs",
47054703
JavadocUtil.quotedPathArgument( JavadocUtil.unifyPathSeparator( extdirs ) ) );
47064704

@@ -4729,6 +4727,9 @@ private void addJavadocOptions( List<String> arguments, List<String> sourcePaths
47294727
{
47304728
addArgIfNotEmpty( arguments, "-subpackages", subpackages, SINCE_JAVADOC_1_5 );
47314729
}
4730+
4731+
// [MJAVADOC-497] must be after sourcepath is recalculated, since getExcludedPackages() depends on it
4732+
addArgIfNotEmpty( arguments, "-exclude", getExcludedPackages( sourcePaths ), SINCE_JAVADOC_1_4 );
47324733

47334734
addArgIf( arguments, verbose, "-verbose" );
47344735

0 commit comments

Comments
 (0)