Skip to content

Commit

Permalink
Align plugin with AbstractMavenReport
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-o committed Nov 19, 2023
1 parent 1952d59 commit a40b703
Show file tree
Hide file tree
Showing 94 changed files with 668 additions and 756 deletions.
7 changes: 7 additions & 0 deletions pom.xml
Expand Up @@ -210,6 +210,13 @@ under the License.
<artifactId>maven-reporting-api</artifactId>
<version>4.0.0-M8</version>
</dependency>
<!-- for Javaodc purposes -->
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-impl</artifactId>
<version>4.0.0-M11</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-archiver</artifactId>
Expand Down
96 changes: 48 additions & 48 deletions src/it/projects/MJAVADOC-320/verify.groovy
@@ -1,48 +1,48 @@

/*
* 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.
*/

File target = new File( basedir, "module2/target" );
assert target.exists()
assert target.isDirectory()

File apidocs = new File( target, "apidocs" );
assert apidocs.exists()
assert apidocs.isDirectory()

// module3 must be included
File module3File = new File( apidocs, "org/apache/maven/plugin/javadoc/it/Module3Class.html" );
assert module3File.exists()
assert module3File.isFile()

// el-api must be included
File elApiFile = new File( apidocs, "javax/el/ValueExpression.html" );
assert elApiFile.exists()
assert elApiFile.isFile()

// module1 must NOT be included
File module1File = new File( apidocs, "org/apache/maven/plugin/javadoc/it/Module1Class.html" );
assert !module1File.exists()
assert !module1File.isFile()

// servlet-api must NOT be included
File servletSpecFile = new File( apidocs, "javax/servlet/ServletContext.html" );
assert !servletSpecFile.exists()
assert !servletSpecFile.isFile()


/*
* 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.
*/

File target = new File( basedir, "module2/target" );
assert target.exists()
assert target.isDirectory()

File apidocs = new File( target, "site/apidocs" );
assert apidocs.exists()
assert apidocs.isDirectory()

// module3 must be included
File module3File = new File( apidocs, "org/apache/maven/plugin/javadoc/it/Module3Class.html" );
assert module3File.exists()
assert module3File.isFile()

// el-api must be included
File elApiFile = new File( apidocs, "javax/el/ValueExpression.html" );
assert elApiFile.exists()
assert elApiFile.isFile()

// module1 must NOT be included
File module1File = new File( apidocs, "org/apache/maven/plugin/javadoc/it/Module1Class.html" );
assert !module1File.exists()
assert !module1File.isFile()

// servlet-api must NOT be included
File servletSpecFile = new File( apidocs, "javax/servlet/ServletContext.html" );
assert !servletSpecFile.exists()
assert !servletSpecFile.isFile()

8 changes: 4 additions & 4 deletions src/it/projects/MJAVADOC-506_excl-module-info/verify.groovy
Expand Up @@ -16,12 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/

def javaVersion = System.getProperty( "java.specification.version" )
if ( javaVersion =~ /(1\..+)|9|10/ ) {
assert new File( basedir, 'target/apidocs/com/foo/MyClass.html').exists()
assert new File( basedir, 'target/site/apidocs/com/foo/MyClass.html').exists()
} else {
assert new File( basedir, 'target/apidocs/M.N/com/foo/MyClass.html').exists()
}
assert new File( basedir, 'target/site/apidocs/M.N/com/foo/MyClass.html').exists()
}


Expand Up @@ -20,9 +20,9 @@
def classFile
int javaVersion = System.getProperty( "java.specification.version" ) as Integer
if ( javaVersion >= 11 ) {
classFile = new File( basedir, 'target/apidocs/jul_to_slf4j/com/testcase/Testcase.html')
classFile = new File( basedir, 'target/site/apidocs/jul_to_slf4j/com/testcase/Testcase.html')
} else {
classFile = new File( basedir, 'target/apidocs/com/testcase/Testcase.html')
classFile = new File( basedir, 'target/site/apidocs/com/testcase/Testcase.html')
}
assert classFile.exists() : "Can't locate ${classFile}"

Expand Down
Expand Up @@ -16,5 +16,5 @@
* specific language governing permissions and limitations
* under the License.
*/
assert new File( basedir, 'target/apidocs/com/foo/MyClass.html').exists()

assert new File( basedir, 'target/site/apidocs/com/foo/MyClass.html').exists()
4 changes: 2 additions & 2 deletions src/it/projects/MJAVADOC-610_mrjar/verify.groovy
Expand Up @@ -20,5 +20,5 @@
def file = new File( basedir, 'target/mjavadoc610-1.0-SNAPSHOT-javadoc.jar' )
assert file.exists()

assert new File( basedir, 'target/apidocs/com.foo/com/foo/MyClass.html').exists()
assert new File( basedir, 'target/apidocs/com.foo/com/foo/OtherClass.html').exists()
assert new File( basedir, 'target/site/apidocs/com.foo/com/foo/MyClass.html').exists()
assert new File( basedir, 'target/site/apidocs/com.foo/com/foo/OtherClass.html').exists()
6 changes: 3 additions & 3 deletions src/it/projects/MJAVADOC-618_modular-war/verify.groovy
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

assert new File( basedir, 'target/apidocs/argfile').readLines().size() == 2
assert new File( basedir, 'target/apidocs/com.mycompany.lib/com/mycompany/lib/Library.html').exists()
assert new File( basedir, 'target/site/apidocs/argfile').readLines().size() == 2
assert new File( basedir, 'target/site/apidocs/com.mycompany.lib/com/mycompany/lib/Library.html').exists()
// module descriptor of com.mycompany.app has no exports, so nothing is documented
assert !new File( basedir, 'target/apidocs/com.mycompany.app/com/mycompany/app/Application.html').exists()
assert !new File( basedir, 'target/site/apidocs/com.mycompany.app/com/mycompany/app/Application.html').exists()
18 changes: 9 additions & 9 deletions src/it/projects/MJAVADOC-639_requires_ignored/verify.groovy
Expand Up @@ -19,25 +19,25 @@ import java.util.jar.JarFile
* specific language governing permissions and limitations
* under the License.
*/

int javaVersion = System.getProperty( "java.specification.version" ) as Integer
if ( javaVersion >= 11 ) {
def index = new File( basedir, 'target/apidocs/index.html')
def index = new File( basedir, 'target/site/apidocs/index.html')

assert index.text =~ /<a href="modulea\/module-summary\.html">modulea<\/a>/
assert index.text =~ /<a href="moduleb\/module-summary\.html">moduleb<\/a>/
assert new File( basedir, 'target/apidocs/modulea/module-summary.html').exists()
assert new File( basedir, 'target/apidocs/moduleb/module-summary.html').exists()
}

assert new File( basedir, 'target/site/apidocs/modulea/module-summary.html').exists()
assert new File( basedir, 'target/site/apidocs/moduleb/module-summary.html').exists()
}
else {
def overview = new File( basedir, 'target/site/apidocs/overview-summary.html')

assert overview.text =~ /<a href="modulea-summary.html">modulea<\/a>/
assert overview.text =~ /<a href="moduleb-summary.html">moduleb<\/a>/
assert new File( basedir, 'target/site/apidocs/modulea-summary.html').exists()
assert new File( basedir, 'target/site/apidocs/moduleb-summary.html').exists()

assert new File( basedir, 'target/site/site/apidocs/modulea-summary.html').exists()
assert new File( basedir, 'target/site/site/apidocs/moduleb-summary.html').exists()
}

def aggregate = new File(basedir, 'target/MJAVADOC-639-1.0.0-SNAPSHOT-javadoc.jar')
Expand Down
2 changes: 0 additions & 2 deletions src/it/projects/MJAVADOC-769/pom.xml
Expand Up @@ -93,8 +93,6 @@
<artifactId>maven-javadoc-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<outputDirectory>${project.build.directory}/apidocs
</outputDirectory>
<release>11</release>
<nodeprecated>false</nodeprecated>
<author>false</author>
Expand Down
2 changes: 1 addition & 1 deletion src/it/projects/MJAVADOC-770/verify.groovy
Expand Up @@ -18,6 +18,6 @@
*/

// new style javadoc has a module summary. legacy mode has not.
def moduleFile = new File( basedir, 'target/apidocs/mjavadoc770/module-summary.html')
def moduleFile = new File( basedir, 'target/site/apidocs/mjavadoc770/module-summary.html')

assert !moduleFile.exists()
102 changes: 51 additions & 51 deletions src/it/projects/dependencySource-1/verify.bsh
@@ -1,51 +1,51 @@
/*
* 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.io.File;
File distroTarget = new File( basedir, "MJAVADOC-280-1-distro/target" );
File apidocs = new File( distroTarget, "apidocs" );
File testApidocs = new File( distroTarget, "testapidocs" );
File f;
if ( !( f = new File( apidocs, "org/apache/maven/plugins/mjavadoc/it/moda/App.html" ) ).exists() )
{
System.out.println( f + " does not exist!" );
return false;
}
if ( !( f = new File( apidocs, "org/apache/maven/plugins/mjavadoc/it/modb/App.html" ) ).exists() )
{
System.out.println( f + " does not exist!" );
return false;
}
if ( !( f = new File( testApidocs, "org/apache/maven/plugins/mjavadoc/it/moda/AppTest.html" ) ).exists() )
{
System.out.println( f + " does not exist!" );
return false;
}
if ( !( f = new File( testApidocs, "org/apache/maven/plugins/mjavadoc/it/modb/AppTest.html" ) ).exists() )
{
System.out.println( f + " does not exist!" );
return false;
}
return true;
/*
* 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.io.File;

File distroTarget = new File( basedir, "MJAVADOC-280-1-distro/target/site" );
File apidocs = new File( distroTarget, "apidocs" );
File testApidocs = new File( distroTarget, "testapidocs" );

File f;
if ( !( f = new File( apidocs, "org/apache/maven/plugins/mjavadoc/it/moda/App.html" ) ).exists() )
{
System.out.println( f + " does not exist!" );
return false;
}

if ( !( f = new File( apidocs, "org/apache/maven/plugins/mjavadoc/it/modb/App.html" ) ).exists() )
{
System.out.println( f + " does not exist!" );
return false;
}

if ( !( f = new File( testApidocs, "org/apache/maven/plugins/mjavadoc/it/moda/AppTest.html" ) ).exists() )
{
System.out.println( f + " does not exist!" );
return false;
}

if ( !( f = new File( testApidocs, "org/apache/maven/plugins/mjavadoc/it/modb/AppTest.html" ) ).exists() )
{
System.out.println( f + " does not exist!" );
return false;
}

return true;

0 comments on commit a40b703

Please sign in to comment.