diff --git a/maven-jxr-plugin/pom.xml b/maven-jxr-plugin/pom.xml index 3b6133aa..0c944926 100644 --- a/maven-jxr-plugin/pom.xml +++ b/maven-jxr-plugin/pom.xml @@ -37,6 +37,7 @@ under the License. 3.2.5 + 1.0.0.v20140518 @@ -85,16 +86,15 @@ under the License. wagon-provider-api 2.8 + + org.apache.maven.reporting + maven-reporting-api + 3.1.1 + org.apache.maven.reporting maven-reporting-impl - 3.1.0 - - - org.codehaus.plexus - plexus-container-default - - + 3.2.0 @@ -126,6 +126,36 @@ under the License. + + org.eclipse.aether + aether-api + ${aetherVersion} + test + + + org.eclipse.aether + aether-impl + ${aetherVersion} + test + + + org.eclipse.aether + aether-connector-basic + ${aetherVersion} + test + + + org.eclipse.aether + aether-transport-wagon + ${aetherVersion} + test + + + org.apache.maven.wagon + wagon-http-lightweight + 3.5.1 + test + junit junit @@ -189,7 +219,6 @@ under the License. maven-invoker-plugin true - src/it ${project.build.directory}/it */pom.xml diff --git a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java index 10f9467d..35c192ef 100644 --- a/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java +++ b/maven-jxr-plugin/src/main/java/org/apache/maven/plugin/jxr/AbstractJxrReport.java @@ -31,22 +31,19 @@ import java.util.Locale; import java.util.ResourceBundle; -import org.apache.maven.doxia.siterenderer.Renderer; +import org.apache.maven.execution.MavenSession; import org.apache.maven.jxr.JXR; import org.apache.maven.jxr.JavaCodeTransform; import org.apache.maven.jxr.JxrException; import org.apache.maven.jxr.pacman.FileManager; import org.apache.maven.jxr.pacman.PackageManager; import org.apache.maven.model.ReportPlugin; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; import org.apache.maven.reporting.AbstractMavenReport; import org.apache.maven.reporting.MavenReportException; import org.codehaus.plexus.languages.java.version.JavaVersion; import org.codehaus.plexus.util.FileUtils; -import org.codehaus.plexus.util.ReaderFactory; import org.codehaus.plexus.util.StringUtils; /** @@ -60,31 +57,9 @@ public abstract class AbstractJxrReport extends AbstractMavenReport { - @Parameter( defaultValue = "${project}", readonly = true, required = true ) - private MavenProject project; - @Component - private Renderer siteRenderer; - - /** - * Output folder where the main page of the report will be generated. Note that this parameter is only relevant if - * the goal is run directly from the command line or from the default lifecycle. If the goal is run indirectly as - * part of a site generation, the output directory configured in the Maven Site Plugin will be used instead. - */ - @Parameter( defaultValue = "${project.reporting.outputDirectory}", required = true ) - private File outputDirectory; - - /** - * File input encoding. - */ - @Parameter( property = "encoding", defaultValue = "${project.build.sourceEncoding}" ) - private String inputEncoding; - - /** - * File output encoding. - */ - @Parameter( property = "outputEncoding", defaultValue = "${project.reporting.outputEncoding}" ) - private String outputEncoding; + @Parameter( defaultValue = "${session}", readonly = true, required = true ) + private MavenSession session; /** * Title of window of the Xref HTML files. @@ -171,18 +146,6 @@ public abstract class AbstractJxrReport */ private JavaVersion javadocTemplatesVersion; - /** - * Gets the effective reporting output files encoding. - * - * @return The effective reporting output file encoding, never null: defaults to UTF-8 - * instead. - */ - @Override - protected String getOutputEncoding() - { - return ( outputEncoding == null ) ? ReaderFactory.UTF_8 : outputEncoding; - } - /** * Compiles the list of directories which contain source files that will be included in the JXR report generation. * @@ -270,16 +233,10 @@ private void createXref( Locale locale, String destinationDirectory, List sourceDirs ) return canGenerate; } - /* - * This is called for a standalone execution. Well, that's the claim. It also ends up called for the aggregate mojo, - * since that is configured as an execution, not in the reporting section, at least by some people on some days. We - * do NOT want the default behavior. - */ - @Override - public void execute() - throws MojoExecutionException - { - - if ( skip ) - { - getLog().info( "Skipping JXR." ); - return; - } - - Locale locale = Locale.getDefault(); - try - { - executeReport( locale ); - } - catch ( MavenReportException e ) - { - throw new MojoExecutionException( "Error generating JXR report", e ); - } - } - @Override protected void executeReport( Locale locale ) throws MavenReportException diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/AbstractJxrTestCase.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/AbstractJxrTestCase.java new file mode 100644 index 00000000..119fb023 --- /dev/null +++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/AbstractJxrTestCase.java @@ -0,0 +1,159 @@ +package org.apache.maven.plugin.jxr; + +/* + * 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; +import java.io.IOException; +import java.nio.file.Files; + +import org.apache.maven.plugin.LegacySupport; +import org.apache.maven.plugin.testing.AbstractMojoTestCase; +import org.apache.maven.plugin.testing.ArtifactStubFactory; +import org.apache.maven.plugin.testing.stubs.MavenProjectStub; +import org.apache.maven.project.DefaultProjectBuildingRequest; +import org.apache.maven.project.MavenProject; +import org.apache.maven.project.ProjectBuilder; +import org.apache.maven.project.ProjectBuildingRequest; +import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory; +import org.eclipse.aether.DefaultRepositorySystemSession; +import org.eclipse.aether.repository.LocalRepository; + +/** + * Abstract class to test reports generation. + */ +public abstract class AbstractJxrTestCase + extends AbstractMojoTestCase +{ + private ArtifactStubFactory artifactStubFactory; + + /** + * The current project to be test. + */ + private MavenProject testMavenProject; + + @Override + protected void setUp() + throws Exception + { + // required for mojo lookups to work + super.setUp(); + + artifactStubFactory = new DependencyArtifactStubFactory( getTestFile( "target" ), true, false ); + artifactStubFactory.getWorkingDir().mkdirs(); + } + + @Override + protected void tearDown() + throws Exception + { + super.tearDown(); + } + + /** + * Get the current Maven project + * + * @return the maven project + */ + protected MavenProject getTestMavenProject() + { + return testMavenProject; + } + + /** + * Get the generated report as file in the test maven project. + * + * @param name the name of the report. + * @return the generated report as file + * @throws IOException if the return file doesnt exist + */ + protected File getGeneratedReport( String name ) + throws IOException + { + String outputDirectory = getBasedir() + "/target/test/unit/" + getTestMavenProject().getArtifactId(); + + File report = new File( outputDirectory, name ); + if ( !report.exists() ) + { + throw new IOException( "File not found. Attempted: " + report ); + } + + return report; + } + + /** + * Generate the report and return the generated file + * + * @param goal the mojo goal. + * @param pluginXml the name of the xml file in "src/test/resources/plugin-configs/". + * @return the generated HTML file + * @throws Exception if any + */ + protected File generateReport( String goal, String pluginXml ) + throws Exception + { + File pluginXmlFile = new File( getBasedir(), "src/test/resources/unit/" + pluginXml ); + AbstractJxrReport mojo = createReportMojo( goal, pluginXmlFile ); + return generateReport( mojo, pluginXmlFile ); + } + + protected AbstractJxrReport createReportMojo( String goal, File pluginXmlFile ) + throws Exception + { + AbstractJxrReport mojo = (AbstractJxrReport) lookupMojo( goal, pluginXmlFile ); + assertNotNull( "Mojo not found.", mojo ); + + LegacySupport legacySupport = lookup( LegacySupport.class ); + legacySupport.setSession( newMavenSession( new MavenProjectStub() ) ); + DefaultRepositorySystemSession repoSession = + (DefaultRepositorySystemSession) legacySupport.getRepositorySession(); + repoSession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( repoSession, new LocalRepository( artifactStubFactory.getWorkingDir() ) ) ); + + setVariableValueToObject( mojo, "session", legacySupport.getSession() ); + setVariableValueToObject( mojo, "remoteRepositories", mojo.getProject().getRemoteArtifactRepositories() ); + return mojo; + } + + protected File generateReport( AbstractJxrReport mojo, File pluginXmlFile ) + throws Exception + { + mojo.execute(); + + ProjectBuilder builder = lookup( ProjectBuilder.class ); + + ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest(); + buildingRequest.setRepositorySession( lookup( LegacySupport.class ).getRepositorySession() ); + + testMavenProject = builder.build( pluginXmlFile, buildingRequest ).getProject(); + + File outputDir = mojo.getReportOutputDirectory(); + String filename = mojo.getOutputName() + ".html"; + + return new File( outputDir, filename ); + } + + /** + * Read the contents of the specified file object into a string + */ + protected String readFile( File xrefTestDir, String fileName ) throws IOException + { + return new String( Files.readAllBytes( xrefTestDir.toPath().resolve( fileName ) ) ); + } + +} diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/DependencyArtifactStubFactory.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/DependencyArtifactStubFactory.java new file mode 100644 index 00000000..dcccfbc1 --- /dev/null +++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/DependencyArtifactStubFactory.java @@ -0,0 +1,69 @@ +package org.apache.maven.plugin.jxr; + +/* + * 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; +import java.io.IOException; + +import org.apache.maven.artifact.Artifact; +import org.apache.maven.artifact.ArtifactUtils; +import org.apache.maven.artifact.versioning.VersionRange; +import org.apache.maven.plugin.testing.ArtifactStubFactory; + +public class DependencyArtifactStubFactory + extends ArtifactStubFactory +{ + private boolean flattenedPath = true; + + public DependencyArtifactStubFactory( File theWorkingDir, boolean theCreateFiles, boolean flattenedPath ) + { + this( theWorkingDir, theCreateFiles ); + this.flattenedPath = flattenedPath; + } + + public DependencyArtifactStubFactory( File theWorkingDir, boolean theCreateFiles ) + { + super( theWorkingDir, theCreateFiles ); + } + + @Override + public Artifact createArtifact( String groupId, String artifactId, VersionRange versionRange, String scope, + String type, String classifier, boolean optional ) + throws IOException + { + File workingDir = getWorkingDir(); + + if ( !flattenedPath ) + { + // don't use flatten directories, won't happen at runtime + String path = groupId.replace( '.', '/' ) + '/' + + artifactId + '/' + + ArtifactUtils.toSnapshotVersion( versionRange.getRecommendedVersion().toString() ); + setWorkingDir( new File( workingDir, path ) ); + } + + Artifact artifact = + super.createArtifact( groupId, artifactId, versionRange, scope, type, classifier, optional ); + + setWorkingDir( workingDir ); + + return artifact; + } +} diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrReportTest.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrReportTest.java index 023938b2..90b0a742 100644 --- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrReportTest.java +++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrReportTest.java @@ -19,11 +19,9 @@ * under the License. */ -import org.apache.maven.plugin.testing.AbstractMojoTestCase; import org.codehaus.plexus.util.FileUtils; import java.io.File; -import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.Locale; @@ -33,7 +31,7 @@ * @author Dennis Lundberg */ public class JxrReportTest - extends AbstractMojoTestCase + extends AbstractJxrTestCase { /** * Test the plugin with original configuration @@ -50,9 +48,7 @@ public void testDefaultConfiguration() FileUtils.copyDirectory( new File( resourcesDir, "javadoc-files" ), outputDir ); - File testPom = new File( resourcesDir, "default-configuration-plugin-config.xml" ); - JxrReport mojo = (JxrReport) lookupMojo( "jxr", testPom ); - mojo.execute(); + generateReport( "jxr", "default-configuration/default-configuration-plugin-config.xml" ); //check if xref files were generated assertTrue( new File( xrefDir, "allclasses-frame.html" ).exists() ); @@ -91,9 +87,7 @@ public void testJdk4Configuration() FileUtils.copyDirectory( new File( resourcesDir, "javadoc-files" ), outputDir ); - File testPom = new File( resourcesDir, "default-configuration-plugin-config-4.xml" ); - JxrReport mojo = (JxrReport) lookupMojo( "jxr", testPom ); - mojo.execute(); + generateReport( "jxr", "default-configuration/default-configuration-plugin-config-4.xml" ); //check if xref files were generated assertTrue( new File( xrefDir, "allclasses-frame.html" ).exists() ); @@ -132,9 +126,7 @@ public void testJdk6Configuration() FileUtils.copyDirectory( new File( resourcesDir, "javadoc-files" ), outputDir ); - File testPom = new File( resourcesDir, "default-configuration-plugin-config-6.xml" ); - JxrReport mojo = (JxrReport) lookupMojo( "jxr", testPom ); - mojo.execute(); + generateReport( "jxr", "default-configuration/default-configuration-plugin-config-6.xml" ); //check if xref files were generated assertTrue( new File( xrefDir, "allclasses-frame.html" ).exists() ); @@ -173,9 +165,7 @@ public void testJdk7Configuration() FileUtils.copyDirectory( new File( resourcesDir, "javadoc-files" ), outputDir ); - File testPom = new File( resourcesDir, "default-configuration-plugin-config-7.xml" ); - JxrReport mojo = (JxrReport) lookupMojo( "jxr", testPom ); - mojo.execute(); + generateReport( "jxr", "default-configuration/default-configuration-plugin-config-7.xml" ); //check if xref files were generated assertTrue( new File( xrefDir, "allclasses-frame.html" ).exists() ); @@ -218,9 +208,7 @@ public void testJdk8Configuration() FileUtils.copyDirectory( new File( resourcesDir, "javadoc-files" ), outputDir ); - File testPom = new File( resourcesDir, "default-configuration-plugin-config-8.xml" ); - JxrReport mojo = (JxrReport) lookupMojo( "jxr", testPom ); - mojo.execute(); + generateReport( "jxr", "default-configuration/default-configuration-plugin-config-8.xml" ); //check if xref files were generated assertTrue( new File( xrefDir, "allclasses-frame.html" ).exists() ); @@ -252,10 +240,7 @@ public void testJdk8Configuration() public void testNoJavadocLink() throws Exception { - File testPom = new File( getBasedir(), - "src/test/resources/unit/nojavadoclink-configuration/nojavadoclink-configuration-plugin-config.xml" ); - JxrReport mojo = (JxrReport) lookupMojo( "jxr", testPom ); - mojo.execute(); + generateReport( "jxr", "nojavadoclink-configuration/nojavadoclink-configuration-plugin-config.xml" ); File xrefDir = new File( getBasedir(), "target/test/unit/nojavadoclink-configuration/target/site/xref" ); @@ -296,10 +281,7 @@ public void testNoJavadocLink() public void testAggregate() throws Exception { - File testPom = new File( getBasedir(), - "src/test/resources/unit/aggregate-test/aggregate-test-plugin-config.xml" ); - JxrReport mojo = (JxrReport) lookupMojo( "jxr", testPom ); - mojo.execute(); + generateReport( "jxr", "aggregate-test/aggregate-test-plugin-config.xml" ); File xrefDir = new File( getBasedir(), "target/test/unit/aggregate-test/target/site/xref" ); @@ -314,7 +296,6 @@ public void testAggregate() assertTrue( new File( xrefDir, "aggregate/test/submodule2/package-summary.html" ).exists() ); assertTrue( new File( xrefDir, "aggregate/test/submodule2/Submodule2App.html" ).exists() ); assertTrue( new File( xrefDir, "aggregate/test/submodule2/Submodule2AppSample.html" ).exists() ); - } /** @@ -325,10 +306,7 @@ public void testAggregate() public void testNoJavadocDir() throws Exception { - File testPom = new File( getBasedir(), - "src/test/resources/unit/nojavadocdir-test/nojavadocdir-test-plugin-config.xml" ); - JxrReport mojo = (JxrReport) lookupMojo( "jxr", testPom ); - mojo.execute(); + generateReport( "jxr", "nojavadocdir-test/nojavadocdir-test-plugin-config.xml" ); File xrefDir = new File( getBasedir(), "target/test/unit/nojavadocdir-test/target/site/xref" ); @@ -338,7 +316,6 @@ public void testNoJavadocDir() str = readFile( xrefDir, "nojavadocdir/test/App.html" ); assertTrue( str.toLowerCase( Locale.US ).contains( "/apidocs/nojavadocdir/test/app.html" ) ); - } /** @@ -349,10 +326,7 @@ public void testNoJavadocDir() public void testExclude() throws Exception { - File testPom = new File( getBasedir(), - "src/test/resources/unit/exclude-configuration/exclude-configuration-plugin-config.xml" ); - JxrReport mojo = (JxrReport) lookupMojo( "jxr", testPom ); - mojo.execute(); + generateReport( "jxr", "exclude-configuration/exclude-configuration-plugin-config.xml" ); Path xrefDir = new File( getBasedir(), "target/test/unit/exclude-configuration/target/site/xref" ).toPath(); @@ -371,10 +345,7 @@ public void testExclude() public void testInclude() throws Exception { - File testPom = new File( getBasedir(), - "src/test/resources/unit/include-configuration/include-configuration-plugin-config.xml" ); - JxrReport mojo = (JxrReport) lookupMojo( "jxr", testPom ); - mojo.execute(); + generateReport( "jxr", "include-configuration/include-configuration-plugin-config.xml" ); Path xrefDir = new File( getBasedir(), "target/test/unit/include-configuration/target/site/xref" ).toPath(); @@ -389,10 +360,7 @@ public void testExceptions() { try { - File testPom = new File( getBasedir(), - "src/test/resources/unit/default-configuration/exception-test-plugin-config.xml" ); - JxrReport mojo = (JxrReport) lookupMojo( "jxr", testPom ); - mojo.execute(); + generateReport( "jxr", "default-configuration/exception-test-plugin-config.xml" ); fail( "Must throw exception" ); } @@ -410,18 +378,9 @@ public void testExceptions() public void testPom() throws Exception { - File testPom = new File( getBasedir(), "src/test/resources/unit/pom-test/pom-test-plugin-config.xml" ); - JxrReport mojo = (JxrReport) lookupMojo( "jxr", testPom ); - mojo.execute(); + generateReport( "jxr", "pom-test/pom-test-plugin-config.xml" ); assertFalse( new File( getBasedir(), "target/test/unit/pom-test" ).exists() ); } - /** - * Read the contents of the specified file object into a string - */ - private String readFile( File xrefTestDir, String fileName ) throws IOException - { - return new String( Files.readAllBytes( xrefTestDir.toPath().resolve( fileName ) ) ); - } } diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrTestReportTest.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrTestReportTest.java index 98bd4569..c70eab21 100644 --- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrTestReportTest.java +++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/JxrTestReportTest.java @@ -23,13 +23,11 @@ import java.io.IOException; import java.nio.file.Files; -import org.apache.maven.plugin.testing.AbstractMojoTestCase; - /** * @author Maria Odea Ching */ public class JxrTestReportTest - extends AbstractMojoTestCase + extends AbstractJxrTestCase { /** * Method to test when the source dir is the test source dir @@ -39,10 +37,7 @@ public class JxrTestReportTest public void testSourceDir() throws Exception { - File testPom = - new File( getBasedir(), "src/test/resources/unit/testsourcedir-test/testsourcedir-test-plugin-config.xml" ); - JxrTestReport mojo = (JxrTestReport) lookupMojo( "test-jxr", testPom ); - mojo.execute(); + generateReport( "test-jxr", "testsourcedir-test/testsourcedir-test-plugin-config.xml" ); File xrefTestDir = new File( getBasedir(), "target/test/unit/testsourcedir-test/target/site/xref-test" ); @@ -65,11 +60,4 @@ public void testSourceDir() assertFalse( str.toLowerCase().contains( "/apidocs/testsourcedir/test/App.html\"".toLowerCase() ) ); } - /** - * Read the contents of the specified file object into a string - */ - private String readFile( File xrefTestDir, String fileName ) throws IOException - { - return new String( Files.readAllBytes( xrefTestDir.toPath().resolve( fileName ) ) ); - } } diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/ExcludeConfigurationMavenProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/ExcludeConfigurationMavenProjectStub.java index 0eec0e3d..24c0fa0e 100644 --- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/ExcludeConfigurationMavenProjectStub.java +++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/ExcludeConfigurationMavenProjectStub.java @@ -23,7 +23,6 @@ import org.apache.maven.model.Model; import org.apache.maven.model.ReportPlugin; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; -import org.apache.maven.plugin.testing.stubs.MavenProjectStub; import java.io.FileReader; import java.util.ArrayList; @@ -32,7 +31,8 @@ /** * @author Dennis Lundberg */ -public class ExcludeConfigurationMavenProjectStub extends MavenProjectStub +public class ExcludeConfigurationMavenProjectStub + extends JxrProjectStub { private List reportPlugins = new ArrayList<>(); diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/IncludeConfigurationMavenProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/IncludeConfigurationMavenProjectStub.java index 3b354888..10a16239 100644 --- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/IncludeConfigurationMavenProjectStub.java +++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/IncludeConfigurationMavenProjectStub.java @@ -23,7 +23,6 @@ import org.apache.maven.model.Model; import org.apache.maven.model.ReportPlugin; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; -import org.apache.maven.plugin.testing.stubs.MavenProjectStub; import java.io.FileReader; import java.util.ArrayList; @@ -32,7 +31,8 @@ /** * @author Dennis Lundberg */ -public class IncludeConfigurationMavenProjectStub extends MavenProjectStub +public class IncludeConfigurationMavenProjectStub + extends JxrProjectStub { private List reportPlugins = new ArrayList<>(); diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/JxrProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/JxrProjectStub.java new file mode 100644 index 00000000..45f4b5f7 --- /dev/null +++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/JxrProjectStub.java @@ -0,0 +1,42 @@ +package org.apache.maven.plugin.jxr.stubs; + +/* + * 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.Collections; +import java.util.List; + +import org.apache.maven.artifact.repository.ArtifactRepository; +import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; +import org.apache.maven.artifact.repository.MavenArtifactRepository; +import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout; +import org.apache.maven.plugin.testing.stubs.MavenProjectStub; + +public abstract class JxrProjectStub + extends MavenProjectStub +{ + @Override + public List getRemoteArtifactRepositories() + { + ArtifactRepository repository = new MavenArtifactRepository( "central", "https://repo1.maven.org/maven2", + new DefaultRepositoryLayout(), new ArtifactRepositoryPolicy(), new ArtifactRepositoryPolicy() ); + + return Collections.singletonList( repository ); + } +} diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/NoJavadocDirMavenProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/NoJavadocDirMavenProjectStub.java index c4c56e6a..0448f953 100644 --- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/NoJavadocDirMavenProjectStub.java +++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/NoJavadocDirMavenProjectStub.java @@ -33,7 +33,7 @@ * @author Maria Odea Ching */ public class NoJavadocDirMavenProjectStub - extends MavenProjectStub + extends JxrProjectStub { private List reportPlugins; diff --git a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/TestSourceDirMavenProjectStub.java b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/TestSourceDirMavenProjectStub.java index 69ca4e66..b4412851 100644 --- a/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/TestSourceDirMavenProjectStub.java +++ b/maven-jxr-plugin/src/test/java/org/apache/maven/plugin/jxr/stubs/TestSourceDirMavenProjectStub.java @@ -22,7 +22,6 @@ import org.apache.maven.artifact.Artifact; import org.apache.maven.model.Model; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; -import org.apache.maven.plugin.testing.stubs.MavenProjectStub; import java.io.FileReader; import java.util.ArrayList; @@ -32,9 +31,9 @@ * @author Maria Odea Ching */ public class TestSourceDirMavenProjectStub - extends MavenProjectStub + extends JxrProjectStub { - + public TestSourceDirMavenProjectStub() { MavenXpp3Reader pomReader = new MavenXpp3Reader(); @@ -67,4 +66,5 @@ public TestSourceDirMavenProjectStub() setArtifact( artifact ); } + } diff --git a/maven-jxr-plugin/src/test/resources/unit/aggregate-test/aggregate-test-plugin-config.xml b/maven-jxr-plugin/src/test/resources/unit/aggregate-test/aggregate-test-plugin-config.xml index 6236fc9d..27bac585 100644 --- a/maven-jxr-plugin/src/test/resources/unit/aggregate-test/aggregate-test-plugin-config.xml +++ b/maven-jxr-plugin/src/test/resources/unit/aggregate-test/aggregate-test-plugin-config.xml @@ -37,7 +37,7 @@ under the License. Maven Jxr Plugin Aggregate Test 1.0-SNAPSHOT Reference ISO-8859-1 ISO-8859-1 - + ${basedir}/src/test/resources/unit/aggregate-test/submodule1 ${basedir}/src/test/resources/unit/aggregate-test/submodule2 @@ -51,6 +51,7 @@ under the License. + ${localRepository} diff --git a/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-4.xml b/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-4.xml index 124f7aab..bf302a1b 100644 --- a/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-4.xml +++ b/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-4.xml @@ -44,6 +44,7 @@ under the License. true Copyright 2006 Apache Foundation 1.4 + ${localRepository} diff --git a/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-6.xml b/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-6.xml index 5f0edb21..eac7aeea 100644 --- a/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-6.xml +++ b/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-6.xml @@ -44,6 +44,7 @@ under the License. true Copyright 2006 Apache Foundation 1.6 + ${localRepository} diff --git a/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-7.xml b/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-7.xml index db16d9de..dbe4d6d0 100644 --- a/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-7.xml +++ b/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-7.xml @@ -44,6 +44,7 @@ under the License. true Copyright 2006 Apache Foundation 1.7 + ${localRepository} diff --git a/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-8.xml b/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-8.xml index 8be96ace..9e330921 100644 --- a/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-8.xml +++ b/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config-8.xml @@ -44,6 +44,7 @@ under the License. true Copyright 2006 Apache Foundation 1.8 + ${localRepository} diff --git a/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config.xml b/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config.xml index 6841a758..1f4769d4 100644 --- a/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config.xml +++ b/maven-jxr-plugin/src/test/resources/unit/default-configuration/default-configuration-plugin-config.xml @@ -46,6 +46,7 @@ under the License. templates stylesheet.css 3 + ${localRepository} diff --git a/maven-jxr-plugin/src/test/resources/unit/default-configuration/exception-test-plugin-config.xml b/maven-jxr-plugin/src/test/resources/unit/default-configuration/exception-test-plugin-config.xml index 1ac1e930..cd37da41 100644 --- a/maven-jxr-plugin/src/test/resources/unit/default-configuration/exception-test-plugin-config.xml +++ b/maven-jxr-plugin/src/test/resources/unit/default-configuration/exception-test-plugin-config.xml @@ -46,6 +46,7 @@ under the License. Copyright 2006 Apache Foundation temp stylesheet.css + ${localRepository} diff --git a/maven-jxr-plugin/src/test/resources/unit/exclude-configuration/exclude-configuration-plugin-config.xml b/maven-jxr-plugin/src/test/resources/unit/exclude-configuration/exclude-configuration-plugin-config.xml index cc61d9f2..d1364876 100644 --- a/maven-jxr-plugin/src/test/resources/unit/exclude-configuration/exclude-configuration-plugin-config.xml +++ b/maven-jxr-plugin/src/test/resources/unit/exclude-configuration/exclude-configuration-plugin-config.xml @@ -49,6 +49,7 @@ under the License. **/AppSample.java + ${localRepository} diff --git a/maven-jxr-plugin/src/test/resources/unit/include-configuration/include-configuration-plugin-config.xml b/maven-jxr-plugin/src/test/resources/unit/include-configuration/include-configuration-plugin-config.xml index 580c19cc..d0cfaed3 100644 --- a/maven-jxr-plugin/src/test/resources/unit/include-configuration/include-configuration-plugin-config.xml +++ b/maven-jxr-plugin/src/test/resources/unit/include-configuration/include-configuration-plugin-config.xml @@ -49,6 +49,7 @@ under the License. **/App.java + ${localRepository} diff --git a/maven-jxr-plugin/src/test/resources/unit/nojavadocdir-test/nojavadocdir-test-plugin-config.xml b/maven-jxr-plugin/src/test/resources/unit/nojavadocdir-test/nojavadocdir-test-plugin-config.xml index 351f7aa4..0c3a0b26 100644 --- a/maven-jxr-plugin/src/test/resources/unit/nojavadocdir-test/nojavadocdir-test-plugin-config.xml +++ b/maven-jxr-plugin/src/test/resources/unit/nojavadocdir-test/nojavadocdir-test-plugin-config.xml @@ -46,6 +46,7 @@ under the License. Copyright 2006 Apache Foundation 1.4 stylesheet.css + ${localRepository} diff --git a/maven-jxr-plugin/src/test/resources/unit/nojavadoclink-configuration/nojavadoclink-configuration-plugin-config.xml b/maven-jxr-plugin/src/test/resources/unit/nojavadoclink-configuration/nojavadoclink-configuration-plugin-config.xml index 6fae9b8c..ba569bce 100644 --- a/maven-jxr-plugin/src/test/resources/unit/nojavadoclink-configuration/nojavadoclink-configuration-plugin-config.xml +++ b/maven-jxr-plugin/src/test/resources/unit/nojavadoclink-configuration/nojavadoclink-configuration-plugin-config.xml @@ -46,6 +46,7 @@ under the License. Copyright 2006 Apache Foundation 1.4 stylesheet.css + ${localRepository} diff --git a/maven-jxr-plugin/src/test/resources/unit/pom-test/pom-test-plugin-config.xml b/maven-jxr-plugin/src/test/resources/unit/pom-test/pom-test-plugin-config.xml index ae65ab4d..257aa0ba 100644 --- a/maven-jxr-plugin/src/test/resources/unit/pom-test/pom-test-plugin-config.xml +++ b/maven-jxr-plugin/src/test/resources/unit/pom-test/pom-test-plugin-config.xml @@ -41,6 +41,7 @@ under the License. ${basedir}/target/test/unit/pom-test/target/site/ + ${localRepository} diff --git a/maven-jxr-plugin/src/test/resources/unit/testsourcedir-test/testsourcedir-test-plugin-config.xml b/maven-jxr-plugin/src/test/resources/unit/testsourcedir-test/testsourcedir-test-plugin-config.xml index 6f08c17d..23bccd90 100644 --- a/maven-jxr-plugin/src/test/resources/unit/testsourcedir-test/testsourcedir-test-plugin-config.xml +++ b/maven-jxr-plugin/src/test/resources/unit/testsourcedir-test/testsourcedir-test-plugin-config.xml @@ -44,6 +44,7 @@ under the License. Copyright 2006 Apache Foundation 1.4 stylesheet.css + ${localRepository} diff --git a/pom.xml b/pom.xml index af3c0554..d5b9153c 100644 --- a/pom.xml +++ b/pom.xml @@ -64,8 +64,8 @@ under the License. 8 - 3.12.0 - 3.4.0 + 3.12.1 + 3.4.1 jxr-archives/jxr-LATEST None 2022-03-15T19:02:53Z