From 0c6b32fb5ec9c31b4e38d9f32616ff51102623da Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Sat, 16 Apr 2022 23:53:29 +0200 Subject: [PATCH] [MJAVADOC-714] Upgrade to Maven 3.2.5 This closes #134 --- pom.xml | 43 +- .../javadoc/AggregatorJavadocReportTest.java | 535 +++++++++--------- .../plugins/javadoc/JavadocReportTest.java | 49 +- .../tagletArtifacts-test-plugin-config.xml | 5 - 4 files changed, 309 insertions(+), 323 deletions(-) diff --git a/pom.xml b/pom.xml index 5d520501f..5f4a94e9d 100644 --- a/pom.xml +++ b/pom.xml @@ -67,11 +67,11 @@ under the License. 8 - 3.0 + 3.2.5 1.11.1 1.11.1 2.4 - 1.13.1 + 1.0.0.v20140518 1.1.0 9.4.43.v20210629 @@ -132,33 +132,33 @@ under the License. - org.sonatype.aether + org.eclipse.aether aether-api - ${sonatypeAetherVersion} + ${aetherVersion} - org.sonatype.aether - aether-connector - ${sonatypeAetherVersion} + org.eclipse.aether + aether-connector-basic + ${aetherVersion} - org.sonatype.aether - aether-connector-wagon - ${sonatypeAetherVersion} + org.eclipse.aether + aether-transport-wagon + ${aetherVersion} - org.sonatype.aether + org.eclipse.aether aether-impl - ${sonatypeAetherVersion} + ${aetherVersion} - org.sonatype.aether + org.eclipse.aether aether-util - ${sonatypeAetherVersion} + ${aetherVersion} - + org.apache.maven @@ -331,7 +331,7 @@ under the License. org.apache.maven.plugin-testing maven-plugin-testing-harness - 2.1 + 3.3.0 test @@ -365,8 +365,13 @@ under the License. test - org.sonatype.aether - aether-connector-wagon + org.eclipse.aether + aether-connector-basic + test + + + org.eclipse.aether + aether-transport-wagon test @@ -468,7 +473,7 @@ under the License. ${maven.home} ${https.protocols} - + true diff --git a/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java b/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java index 7f58c9de4..338bdc23b 100644 --- a/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java +++ b/src/test/java/org/apache/maven/plugins/javadoc/AggregatorJavadocReportTest.java @@ -1,267 +1,268 @@ -package org.apache.maven.plugins.javadoc; - -/* - * 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.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.List; -import java.util.Locale; - -import org.apache.maven.execution.MavenSession; -import org.apache.maven.model.Plugin; -import org.apache.maven.plugin.MojoExecution; -import org.apache.maven.plugin.testing.AbstractMojoTestCase; -import org.apache.maven.plugin.testing.stubs.MavenProjectStub; -import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.languages.java.version.JavaVersion; -import org.codehaus.plexus.util.FileUtils; -import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager; -import org.sonatype.aether.util.DefaultRepositorySystemSession; - -public class AggregatorJavadocReportTest - extends AbstractMojoTestCase -{ - private static final char LINE_SEPARATOR = ' '; - - /** flag to copy repo only one time */ - private static boolean TEST_REPO_CREATED = false; - - private File unit; - - private File localRepo; - - /** {@inheritDoc} */ - @Override - protected void setUp() - throws Exception - { - super.setUp(); - - unit = new File( getBasedir(), "src/test/resources/unit" ); - - localRepo = new File( getBasedir(), "target/local-repo/" ); - - createTestRepo(); - } - - private JavadocReport lookupMojo( File testPom ) - throws Exception - { - JavadocReport mojo = (JavadocReport) lookupMojo( "aggregate", testPom ); - - MojoExecution mojoExec = new MojoExecution( new Plugin(), "aggregate", null ); - setVariableValueToObject( mojo, "mojo", mojoExec ); - - MavenProject currentProject = new MavenProjectStub(); - currentProject.setGroupId( "GROUPID" ); - currentProject.setArtifactId( "ARTIFACTID" ); - - MavenSession session = newMavenSession( currentProject ); - DefaultRepositorySystemSession repoSysSession = (DefaultRepositorySystemSession) session.getRepositorySession(); - repoSysSession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( localRepo ) ); - setVariableValueToObject( mojo, "session", session ); - - return mojo; - } - - /** - * Create test repository in target directory. - * - * @throws IOException if any - */ - private void createTestRepo() - throws IOException - { - if ( TEST_REPO_CREATED ) - { - return; - } - - localRepo.mkdirs(); - - // ---------------------------------------------------------------------- - // UMLGraph - // ---------------------------------------------------------------------- - - File sourceDir = new File( unit, "doclet-test/artifact-doclet" ); - assertTrue( sourceDir.exists() ); - FileUtils.copyDirectoryStructure( sourceDir, localRepo ); - - // ---------------------------------------------------------------------- - // UMLGraph-bis - // ---------------------------------------------------------------------- - - sourceDir = new File( unit, "doclet-path-test/artifact-doclet" ); - assertTrue( sourceDir.exists() ); - FileUtils.copyDirectoryStructure( sourceDir, localRepo ); - - // ---------------------------------------------------------------------- - // commons-attributes-compiler - // http://www.tullmann.org/pat/taglets/ - // ---------------------------------------------------------------------- - - sourceDir = new File( unit, "taglet-test/artifact-taglet" ); - assertTrue( sourceDir.exists() ); - FileUtils.copyDirectoryStructure( sourceDir, localRepo ); - - // ---------------------------------------------------------------------- - // stylesheetfile-test - // ---------------------------------------------------------------------- - - sourceDir = new File( unit, "stylesheetfile-test/artifact-stylesheetfile" ); - assertTrue( sourceDir.exists() ); - FileUtils.copyDirectoryStructure( sourceDir, localRepo ); - - // ---------------------------------------------------------------------- - // helpfile-test - // ---------------------------------------------------------------------- - - sourceDir = new File( unit, "helpfile-test/artifact-helpfile" ); - assertTrue( sourceDir.exists() ); - FileUtils.copyDirectoryStructure( sourceDir, localRepo ); - - // Remove SCM files - List files = FileUtils.getFileAndDirectoryNames( localRepo, FileUtils.getDefaultExcludesAsString(), - null, true, true, true, true ); - for ( String filename : files ) - { - File file = new File( filename ); - - if ( file.isDirectory() ) - { - FileUtils.deleteDirectory( file ); - } - else - { - file.delete(); - } - } - - TEST_REPO_CREATED = true; - } - - /** - * Convenience method that reads the contents of the specified file object into a string with a space - * as line separator. - * - * @see #LINE_SEPARATOR - * @param file the file to be read - * @return a String object that contains the contents of the file - * @throws IOException if any - */ - private static String readFile( File file ) - throws IOException - { - StringBuilder str = new StringBuilder( (int) file.length() ); - - try (BufferedReader in = new BufferedReader(new FileReader(file))) { - - for ( String strTmp ; ( strTmp = in.readLine() ) != null ; ) { - str.append( LINE_SEPARATOR ); - str.append( strTmp ); - } - } - - return str.toString(); - } - - /** - * Method to test the aggregate parameter - * - * @throws Exception if any - */ - public void testAggregate() - throws Exception - { - File testPom = new File( unit, "aggregate-test/aggregate-test-plugin-config.xml" ); - JavadocReport mojo = lookupMojo( testPom ); - mojo.execute(); - - File apidocs = new File( getBasedir(), "target/test/unit/aggregate-test/target/site/apidocs/" ); - - // check if project1 api files exist - assertTrue( new File( apidocs, "aggregate/test/project1/Project1App.html" ).exists() ); - assertTrue( new File( apidocs, "aggregate/test/project1/Project1AppSample.html" ).exists() ); - assertTrue( new File( apidocs, "aggregate/test/project1/Project1Sample.html" ).exists() ); - assertTrue( new File( apidocs, "aggregate/test/project1/Project1Test.html" ).exists() ); - - // check if project2 api files exist - assertTrue( new File( apidocs, "aggregate/test/project2/Project2App.html" ).exists() ); - assertTrue( new File( apidocs, "aggregate/test/project2/Project2AppSample.html" ).exists() ); - assertTrue( new File( apidocs, "aggregate/test/project2/Project2Sample.html" ).exists() ); - assertTrue( new File( apidocs, "aggregate/test/project2/Project2Test.html" ).exists() ); - } - - /** - * Test the javadoc resources in the aggregation case. - * - * @throws Exception if any - */ - public void testAggregateJavadocResources() - throws Exception - { - File testPom = new File( unit, "aggregate-resources-test/aggregate-resources-test-plugin-config.xml" ); - JavadocReport mojo = lookupMojo( testPom ); - mojo.execute(); - - File apidocs = new File( getBasedir(), "target/test/unit/aggregate-resources-test/target/site/apidocs" ); - - // Test overview - File overviewSummary = getOverviewSummary(apidocs); - - assertTrue( overviewSummary.exists() ); - String overview = readFile( overviewSummary ).toLowerCase( Locale.ENGLISH ); - assertTrue( overview.contains( "resources.test" ) ); - assertTrue( overview.contains( ">blablaresources.test2" ) ); - assertTrue( overview.contains( "resources2.test" ) ); - assertTrue( overview.contains( "resources2.test2" ) ); - - // Test doc-files - File app = new File( apidocs, "resources/test/App.html" ); - assertTrue( app.exists() ); - overview = readFile( app ); - assertTrue( overview.contains( "\"Maven\"" ) ); - assertTrue( new File( apidocs, "resources/test/doc-files/maven-feather.png" ).exists() ); - } - - public void testAggregateWithModulsNotInSubFolders() throws Exception - { - File testPom = new File( unit, "aggregate-modules-not-in-subfolders-test/all/pom.xml"); - JavadocReport mojo = lookupMojo( testPom ); - mojo.execute(); - - File apidocs = new File( getBasedir(), "target/test/unit/aggregate-modules-not-in-subfolders-test/target/site/apidocs" ); - assertTrue( apidocs.isDirectory() ); - assertTrue( getOverviewSummary( apidocs ).isFile() ); - } - - private static File getOverviewSummary(File apidocs) - { - if ( JavaVersion.JAVA_SPECIFICATION_VERSION.isBefore( "11" ) ) - { - return new File( apidocs, "overview-summary.html" ); - } - return new File( apidocs, "index.html" ); - } - -} +package org.apache.maven.plugins.javadoc; + +/* + * 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.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.util.List; +import java.util.Locale; + +import org.apache.maven.execution.MavenSession; +import org.apache.maven.model.Plugin; +import org.apache.maven.plugin.MojoExecution; +import org.apache.maven.plugin.testing.AbstractMojoTestCase; +import org.apache.maven.plugin.testing.stubs.MavenProjectStub; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.languages.java.version.JavaVersion; +import org.codehaus.plexus.util.FileUtils; +import org.eclipse.aether.DefaultRepositorySystemSession; +import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory; +import org.eclipse.aether.repository.LocalRepository; + +public class AggregatorJavadocReportTest + extends AbstractMojoTestCase +{ + private static final char LINE_SEPARATOR = ' '; + + /** flag to copy repo only one time */ + private static boolean TEST_REPO_CREATED = false; + + private File unit; + + private File localRepo; + + /** {@inheritDoc} */ + @Override + protected void setUp() + throws Exception + { + super.setUp(); + + unit = new File( getBasedir(), "src/test/resources/unit" ); + + localRepo = new File( getBasedir(), "target/local-repo/" ); + + createTestRepo(); + } + + private JavadocReport lookupMojo( File testPom ) + throws Exception + { + JavadocReport mojo = (JavadocReport) lookupMojo( "aggregate", testPom ); + + MojoExecution mojoExec = new MojoExecution( new Plugin(), "aggregate", null ); + setVariableValueToObject( mojo, "mojo", mojoExec ); + + MavenProject currentProject = new MavenProjectStub(); + currentProject.setGroupId( "GROUPID" ); + currentProject.setArtifactId( "ARTIFACTID" ); + + MavenSession session = newMavenSession( currentProject ); + DefaultRepositorySystemSession repoSysSession = (DefaultRepositorySystemSession) session.getRepositorySession(); + repoSysSession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( repoSysSession, new LocalRepository( localRepo ) ) ); + setVariableValueToObject( mojo, "session", session ); + + return mojo; + } + + /** + * Create test repository in target directory. + * + * @throws IOException if any + */ + private void createTestRepo() + throws IOException + { + if ( TEST_REPO_CREATED ) + { + return; + } + + localRepo.mkdirs(); + + // ---------------------------------------------------------------------- + // UMLGraph + // ---------------------------------------------------------------------- + + File sourceDir = new File( unit, "doclet-test/artifact-doclet" ); + assertTrue( sourceDir.exists() ); + FileUtils.copyDirectoryStructure( sourceDir, localRepo ); + + // ---------------------------------------------------------------------- + // UMLGraph-bis + // ---------------------------------------------------------------------- + + sourceDir = new File( unit, "doclet-path-test/artifact-doclet" ); + assertTrue( sourceDir.exists() ); + FileUtils.copyDirectoryStructure( sourceDir, localRepo ); + + // ---------------------------------------------------------------------- + // commons-attributes-compiler + // http://www.tullmann.org/pat/taglets/ + // ---------------------------------------------------------------------- + + sourceDir = new File( unit, "taglet-test/artifact-taglet" ); + assertTrue( sourceDir.exists() ); + FileUtils.copyDirectoryStructure( sourceDir, localRepo ); + + // ---------------------------------------------------------------------- + // stylesheetfile-test + // ---------------------------------------------------------------------- + + sourceDir = new File( unit, "stylesheetfile-test/artifact-stylesheetfile" ); + assertTrue( sourceDir.exists() ); + FileUtils.copyDirectoryStructure( sourceDir, localRepo ); + + // ---------------------------------------------------------------------- + // helpfile-test + // ---------------------------------------------------------------------- + + sourceDir = new File( unit, "helpfile-test/artifact-helpfile" ); + assertTrue( sourceDir.exists() ); + FileUtils.copyDirectoryStructure( sourceDir, localRepo ); + + // Remove SCM files + List files = FileUtils.getFileAndDirectoryNames( localRepo, FileUtils.getDefaultExcludesAsString(), + null, true, true, true, true ); + for ( String filename : files ) + { + File file = new File( filename ); + + if ( file.isDirectory() ) + { + FileUtils.deleteDirectory( file ); + } + else + { + file.delete(); + } + } + + TEST_REPO_CREATED = true; + } + + /** + * Convenience method that reads the contents of the specified file object into a string with a space + * as line separator. + * + * @see #LINE_SEPARATOR + * @param file the file to be read + * @return a String object that contains the contents of the file + * @throws IOException if any + */ + private static String readFile( File file ) + throws IOException + { + StringBuilder str = new StringBuilder( (int) file.length() ); + + try (BufferedReader in = new BufferedReader(new FileReader(file))) { + + for ( String strTmp ; ( strTmp = in.readLine() ) != null ; ) { + str.append( LINE_SEPARATOR ); + str.append( strTmp ); + } + } + + return str.toString(); + } + + /** + * Method to test the aggregate parameter + * + * @throws Exception if any + */ + public void testAggregate() + throws Exception + { + File testPom = new File( unit, "aggregate-test/aggregate-test-plugin-config.xml" ); + JavadocReport mojo = lookupMojo( testPom ); + mojo.execute(); + + File apidocs = new File( getBasedir(), "target/test/unit/aggregate-test/target/site/apidocs/" ); + + // check if project1 api files exist + assertTrue( new File( apidocs, "aggregate/test/project1/Project1App.html" ).exists() ); + assertTrue( new File( apidocs, "aggregate/test/project1/Project1AppSample.html" ).exists() ); + assertTrue( new File( apidocs, "aggregate/test/project1/Project1Sample.html" ).exists() ); + assertTrue( new File( apidocs, "aggregate/test/project1/Project1Test.html" ).exists() ); + + // check if project2 api files exist + assertTrue( new File( apidocs, "aggregate/test/project2/Project2App.html" ).exists() ); + assertTrue( new File( apidocs, "aggregate/test/project2/Project2AppSample.html" ).exists() ); + assertTrue( new File( apidocs, "aggregate/test/project2/Project2Sample.html" ).exists() ); + assertTrue( new File( apidocs, "aggregate/test/project2/Project2Test.html" ).exists() ); + } + + /** + * Test the javadoc resources in the aggregation case. + * + * @throws Exception if any + */ + public void testAggregateJavadocResources() + throws Exception + { + File testPom = new File( unit, "aggregate-resources-test/aggregate-resources-test-plugin-config.xml" ); + JavadocReport mojo = lookupMojo( testPom ); + mojo.execute(); + + File apidocs = new File( getBasedir(), "target/test/unit/aggregate-resources-test/target/site/apidocs" ); + + // Test overview + File overviewSummary = getOverviewSummary(apidocs); + + assertTrue( overviewSummary.exists() ); + String overview = readFile( overviewSummary ).toLowerCase( Locale.ENGLISH ); + assertTrue( overview.contains( "resources.test" ) ); + assertTrue( overview.contains( ">blablaresources.test2" ) ); + assertTrue( overview.contains( "resources2.test" ) ); + assertTrue( overview.contains( "resources2.test2" ) ); + + // Test doc-files + File app = new File( apidocs, "resources/test/App.html" ); + assertTrue( app.exists() ); + overview = readFile( app ); + assertTrue( overview.contains( "\"Maven\"" ) ); + assertTrue( new File( apidocs, "resources/test/doc-files/maven-feather.png" ).exists() ); + } + + public void testAggregateWithModulsNotInSubFolders() throws Exception + { + File testPom = new File( unit, "aggregate-modules-not-in-subfolders-test/all/pom.xml"); + JavadocReport mojo = lookupMojo( testPom ); + mojo.execute(); + + File apidocs = new File( getBasedir(), "target/test/unit/aggregate-modules-not-in-subfolders-test/target/site/apidocs" ); + assertTrue( apidocs.isDirectory() ); + assertTrue( getOverviewSummary( apidocs ).isFile() ); + } + + private static File getOverviewSummary(File apidocs) + { + if ( JavaVersion.JAVA_SPECIFICATION_VERSION.isBefore( "11" ) ) + { + return new File( apidocs, "overview-summary.html" ); + } + return new File( apidocs, "index.html" ); + } + +} diff --git a/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java b/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java index 3dc5ffdde..4200ec055 100644 --- a/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java +++ b/src/test/java/org/apache/maven/plugins/javadoc/JavadocReportTest.java @@ -54,17 +54,18 @@ import org.apache.maven.plugins.javadoc.ProxyServer.AuthAsyncProxyServlet; import org.apache.maven.project.MavenProject; import org.apache.maven.project.ProjectBuildingRequest; -import org.apache.maven.repository.internal.MavenRepositorySystemSession; import org.apache.maven.settings.Proxy; import org.apache.maven.settings.Settings; import org.apache.maven.shared.utils.StringUtils; import org.apache.maven.shared.utils.io.FileUtils; import org.codehaus.plexus.languages.java.version.JavaVersion; +import org.eclipse.aether.DefaultRepositorySystemSession; +import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory; +import org.eclipse.aether.repository.LocalRepository; import org.hamcrest.MatcherAssert; import org.junit.AssumptionViolatedException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager; /** * Test {@link org.apache.maven.plugins.javadoc.JavadocReport} class. @@ -505,8 +506,8 @@ public void testDoclets() ProjectBuildingRequest buildingRequest = mock( ProjectBuildingRequest.class ); when( buildingRequest.getRemoteRepositories() ).thenReturn( mojo.project.getRemoteArtifactRepositories() ); when( session.getProjectBuildingRequest() ).thenReturn( buildingRequest ); - MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession(); - repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( localRepo ) ); + DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); + repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( repositorySession, new LocalRepository( localRepo ) ) ); when( buildingRequest.getRepositorySession() ).thenReturn( repositorySession ); when( session.getRepositorySession() ).thenReturn( repositorySession ); LegacySupport legacySupport = lookup( LegacySupport.class ); @@ -687,8 +688,8 @@ public void testTaglets() ProjectBuildingRequest buildingRequest = mock( ProjectBuildingRequest.class ); when( buildingRequest.getRemoteRepositories() ).thenReturn( mojo.project.getRemoteArtifactRepositories() ); when( session.getProjectBuildingRequest() ).thenReturn( buildingRequest ); - MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession(); - repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( localRepo ) ); + DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); + repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( repositorySession, new LocalRepository( localRepo ) ) ); when( buildingRequest.getRepositorySession() ).thenReturn( repositorySession ); when( session.getRepositorySession() ).thenReturn( repositorySession ); LegacySupport legacySupport = lookup( LegacySupport.class ); @@ -982,8 +983,8 @@ public void testProxy() ProjectBuildingRequest buildingRequest = mock( ProjectBuildingRequest.class ); when( buildingRequest.getRemoteRepositories() ).thenReturn( mojo.project.getRemoteArtifactRepositories() ); when( session.getProjectBuildingRequest() ).thenReturn( buildingRequest ); - MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession(); - repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( localRepo ) ); + DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); + repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( repositorySession, new LocalRepository( localRepo ) ) ); when( buildingRequest.getRepositorySession() ).thenReturn( repositorySession ); when( session.getRepositorySession() ).thenReturn( repositorySession ); LegacySupport legacySupport = lookup( LegacySupport.class ); @@ -1194,8 +1195,8 @@ public void testTagletArtifacts() ProjectBuildingRequest buildingRequest = mock( ProjectBuildingRequest.class ); when( buildingRequest.getRemoteRepositories() ).thenReturn( mojo.project.getRemoteArtifactRepositories() ); when( session.getProjectBuildingRequest() ).thenReturn( buildingRequest ); - MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession(); - repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( localRepo ) ); + DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); + repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( repositorySession, new LocalRepository( localRepo ) ) ); when( buildingRequest.getRepositorySession() ).thenReturn( repositorySession ); when( session.getRepositorySession() ).thenReturn( repositorySession ); LegacySupport legacySupport = lookup( LegacySupport.class ); @@ -1208,24 +1209,8 @@ public void testTagletArtifacts() assertThat( optionsFile ).exists(); String options = readFile( optionsFile ); // count -taglet - assertThat( StringUtils.countMatches( options, LINE_SEPARATOR + "-taglet" + LINE_SEPARATOR ) ).isEqualTo( 22 ); - assertThat( options ).contains( "org.apache.maven.tools.plugin.javadoc.MojoAggregatorTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoComponentFieldTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoConfiguratorTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoExecuteTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoExecutionStrategyTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoGoalTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoInheritByDefaultTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoInstantiationStrategyTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoParameterFieldTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoPhaseTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoReadOnlyFieldTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoRequiredFieldTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoRequiresDependencyResolutionTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoRequiresDirectInvocationTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoRequiresOnLineTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoRequiresProjectTypeTaglet" ) - .contains( "org.apache.maven.tools.plugin.javadoc.MojoRequiresReportsTypeTaglet" ) + assertThat( StringUtils.countMatches( options, LINE_SEPARATOR + "-taglet" + LINE_SEPARATOR ) ).isEqualTo( 3 ); + assertThat( options ) .contains( "org.codehaus.plexus.javadoc.PlexusConfigurationTaglet" ) .contains( "org.codehaus.plexus.javadoc.PlexusRequirementTaglet" ) .contains( "org.codehaus.plexus.javadoc.PlexusComponentTaglet" ); @@ -1248,8 +1233,8 @@ public void testStylesheetfile() ProjectBuildingRequest buildingRequest = mock( ProjectBuildingRequest.class ); when( buildingRequest.getRemoteRepositories() ).thenReturn( mojo.project.getRemoteArtifactRepositories() ); when( session.getProjectBuildingRequest() ).thenReturn( buildingRequest ); - MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession(); - repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( localRepo ) ); + DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); + repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( repositorySession, new LocalRepository( localRepo ) ) ); when( buildingRequest.getRepositorySession() ).thenReturn( repositorySession ); when( session.getRepositorySession() ).thenReturn( repositorySession ); LegacySupport legacySupport = lookup( LegacySupport.class ); @@ -1370,8 +1355,8 @@ public void testHelpfile() ProjectBuildingRequest buildingRequest = mock( ProjectBuildingRequest.class ); when( buildingRequest.getRemoteRepositories() ).thenReturn( mojo.project.getRemoteArtifactRepositories() ); when( session.getProjectBuildingRequest() ).thenReturn( buildingRequest ); - MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession(); - repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManager( localRepo ) ); + DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession(); + repositorySession.setLocalRepositoryManager( new SimpleLocalRepositoryManagerFactory().newInstance( repositorySession, new LocalRepository( localRepo ) ) ); when( buildingRequest.getRepositorySession() ).thenReturn( repositorySession ); when( session.getRepositorySession() ).thenReturn( repositorySession ); LegacySupport legacySupport = lookup( LegacySupport.class ); diff --git a/src/test/resources/unit/tagletArtifacts-test/tagletArtifacts-test-plugin-config.xml b/src/test/resources/unit/tagletArtifacts-test/tagletArtifacts-test-plugin-config.xml index 0656dc06c..8639b5575 100644 --- a/src/test/resources/unit/tagletArtifacts-test/tagletArtifacts-test-plugin-config.xml +++ b/src/test/resources/unit/tagletArtifacts-test/tagletArtifacts-test-plugin-config.xml @@ -65,11 +65,6 @@ under the License. true true - - org.apache.maven.plugin-tools - maven-plugin-tools-javadoc - 3.5 - org.codehaus.plexus plexus-javadoc