Skip to content

Commit

Permalink
[MJAVADOC-743] Drop deprecated mojo parameter
Browse files Browse the repository at this point in the history
The type is deprecated and parameter is redundant as LRM that is
already present has the value.

---

https://issues.apache.org/jira/browse/MJAVADOC-743
  • Loading branch information
cstamas authored and slachiewicz committed Aug 15, 2023
1 parent ea0ddf5 commit 9e13239
Show file tree
Hide file tree
Showing 45 changed files with 19 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
import org.apache.commons.text.StringEscapeUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DependencyResolutionRequiredException;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
Expand Down Expand Up @@ -350,12 +349,6 @@ public abstract class AbstractFixJavadocMojo extends AbstractMojo {
@Parameter(property = "level", defaultValue = "protected")
private String level;

/**
* The local repository where the artifacts are located, used by the tests.
*/
@Parameter(property = "localRepository")
private ArtifactRepository localRepository;

/**
* Output directory where Java classes will be rewritten.
*/
Expand Down Expand Up @@ -657,7 +650,7 @@ private void executeClirr() throws MavenInvocationException {

JavadocUtil.invokeMaven(
getLog(),
new File(localRepository.getBasedir()),
session.getRepositorySession().getLocalRepository().getBasedir(),
project.getFile(),
Collections.singletonList(clirrGoal),
properties,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
import org.apache.maven.artifact.ArtifactUtils;
import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
import org.apache.maven.execution.MavenSession;
Expand Down Expand Up @@ -416,12 +415,6 @@ public abstract class AbstractJavadocMojo extends AbstractMojo {
@Parameter(property = "resourcesArtifacts")
private ResourcesArtifact[] resourcesArtifacts;

/**
* The local repository where the artifacts are located.
*/
@Parameter(property = "localRepository")
private ArtifactRepository localRepository;

/**
* The projects in the reactor for aggregation report.
*/
Expand Down Expand Up @@ -5476,7 +5469,7 @@ private List<OfflineLink> getModulesLinks() throws MavenReportException {
try {
JavadocUtil.invokeMaven(
getLog(),
new File(localRepository.getBasedir()),
session.getRepositorySession().getLocalRepository().getBasedir(),
p.getFile(),
Collections.singletonList(javadocGoal),
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
import org.apache.maven.shared.invoker.MavenInvocationException;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
import org.eclipse.aether.repository.LocalRepository;

import static org.apache.commons.lang3.reflect.MethodUtils.invokeMethod;

Expand Down Expand Up @@ -496,6 +499,10 @@ private void executeMojoAndTest(File testPomBasedir, String[] clazzToCompare) th
assertNotNull(mojo);

MavenSession session = newMavenSession(mojo.getProject());
((DefaultRepositorySystemSession) session.getRepositorySession())
.setLocalRepositoryManager(new SimpleLocalRepositoryManagerFactory()
.newInstance(
session.getRepositorySession(), new LocalRepository(new File("target/local-repo"))));
// Ensure remote repo connection uses SSL
File globalSettingsFile = new File(getBasedir(), "target/test-classes/unit/settings.xml");
session.getRequest().setGlobalSettingsFile(globalSettingsFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;

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.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.internal.impl.SimpleLocalRepositoryManagerFactory;
import org.eclipse.aether.repository.LocalRepository;

import static org.assertj.core.api.Assertions.assertThat;

Expand All @@ -50,7 +54,12 @@ private JavadocJar lookupMojo(File testPom) throws Exception {
currentProject.setGroupId("GROUPID");
currentProject.setArtifactId("ARTIFACTID");

setVariableValueToObject(mojo, "session", newMavenSession(currentProject));
MavenSession session = newMavenSession(currentProject);
((DefaultRepositorySystemSession) session.getRepositorySession())
.setLocalRepositoryManager(new SimpleLocalRepositoryManagerFactory()
.newInstance(
session.getRepositorySession(), new LocalRepository(new File("target/local-repo"))));
setVariableValueToObject(mojo, "session", session);

return mojo;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ under the License.
<configuration>
<encoding>ISO-8859-1</encoding>
<project implementation="org.apache.maven.plugins.javadoc.stubs.AggregateNotInSubFolderTestMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<outputDirectory>${basedir}/target/test/unit/aggregate-modules-not-in-subfolders-test/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/aggregate-modules-not-in-subfolders-test/target/javadoc-bundle-options</javadocOptionsDir>
<windowtitle>Maven Javadoc Plugin aggregate resources 1.0-SNAPSHOT API</windowtitle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ under the License.
<configuration>
<encoding>ISO-8859-1</encoding>
<project implementation="org.apache.maven.plugins.javadoc.stubs.AggregateResourcesTestMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<outputDirectory>${basedir}/target/test/unit/aggregate-resources-test/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/aggregate-resources-test/target/javadoc-bundle-options</javadocOptionsDir>
<windowtitle>Maven Javadoc Plugin aggregate resources 1.0-SNAPSHOT API</windowtitle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ under the License.
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.AggregateTestMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<outputDirectory>${basedir}/target/test/unit/aggregate-test/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/aggregate-test/target/javadoc-bundle-options</javadocOptionsDir>
<breakiterator>false</breakiterator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ under the License.
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.CustomConfigurationMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<outputDirectory>${basedir}/target/test/unit/custom-configuration/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/custom-configuration/target/javadoc-bundle-options</javadocOptionsDir>
<breakiterator>false</breakiterator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ under the License.
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.DefaultConfigurationMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<outputDirectory>${basedir}/target/test/unit/default-configuration/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/default-configuration/target/javadoc-bundle-options</javadocOptionsDir>
<breakiterator>false</breakiterator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ under the License.
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.DocfilesTestMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<outputDirectory>${basedir}/target/test/unit/docfiles-test/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/docfiles-test/target/javadoc-bundle-options</javadocOptionsDir>
<breakiterator>false</breakiterator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ under the License.
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.DocfilesWithJavaTestMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<outputDirectory>${basedir}/target/test/unit/docfiles-with-java-test/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/docfiles-with-java-test/target/javadoc-bundle-options</javadocOptionsDir>
<javadocDirectory>${basedir}/src/test/resources/unit/docfiles-with-java-test/src/main</javadocDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ under the License.
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.DocletPathTestMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<outputDirectory>${basedir}/target/test/unit/doclet-path-test/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/doclet-path-test/target/javadoc-bundle-options</javadocOptionsDir>
<doclet>UmlGraph</doclet>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ under the License.
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.DocletTestMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<outputDirectory>${basedir}/target/test/unit/doclet-test/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/doclet-test/target/javadoc-bundle-options</javadocOptionsDir>
<doclet>UmlGraph</doclet>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ under the License.
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.SubpackagesTestMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<outputDirectory>${basedir}/target/test/unit/file-include-exclude-test/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/file-include-exclude-test/target/javadoc-bundle-options</javadocOptionsDir>
<breakiterator>false</breakiterator>
Expand Down
1 change: 0 additions & 1 deletion src/test/resources/unit/fix-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.FixMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<outputDirectory>${basedir}/target/test/unit/fix-test/target/generated</outputDirectory>
<defaultSince>1.1-SNAPSHOT</defaultSince>
<encoding>UTF-8</encoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ under the License.
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.HeaderFooterTestMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<outputDirectory>${basedir}/target/test/unit/header-footer-test/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/header-footer-test/target/javadoc-bundle-options</javadocOptionsDir>
<show>protected</show>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ under the License.
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.HelpFileMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<outputDirectory>${basedir}/target/test/unit/helpfile-test/target/site/apidocs</outputDirectory>
<javadocDirectory>${basedir}/src/test/resources/unit/helpfile-test/src/main/javadoc</javadocDirectory>
<breakiterator>false</breakiterator>
Expand Down
1 change: 0 additions & 1 deletion src/test/resources/unit/helpfile-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ under the License.
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.HelpFileMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<outputDirectory>${basedir}/target/test/unit/helpfile-test/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/helpfile-test/target/javadoc-bundle-options</javadocOptionsDir>
<javadocDirectory>${basedir}/src/test/resources/unit/helpfile-test/src/main/javadoc</javadocDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ under the License.
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.DefaultConfigurationMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<outputDirectory>${basedir}/target/test/unit/javaHome-test/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/javaHome-test/target/javadoc-bundle-options</javadocOptionsDir>
<breakiterator>false</breakiterator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ under the License.
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.JavadocJarArchiveConfigProjectStub"/>
<localRepository>${localRepository}</localRepository>
<jarOutputDirectory>${basedir}/target/test/unit/javadocjar-archive-config/target</jarOutputDirectory>
<outputDirectory>${basedir}/target/test/unit/javadocjar-archive-config/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/javadocjar-archive-config/target/javadoc-bundle-options</javadocOptionsDir>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ under the License.
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.JavadocJarDefaultMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<jarOutputDirectory>${basedir}/target/test/unit/javadocjar-default/target</jarOutputDirectory>
<outputDirectory>${basedir}/target/test/unit/javadocjar-default/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/javadocjar-default/target/javadoc-bundle-options</javadocOptionsDir>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ under the License.
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.JavadocJarFailOnErrorMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<jarOutputDirectory>${basedir}/target/test/unit/javadocjar-failonerror/target</jarOutputDirectory>
<outputDirectory>${basedir}/target/test/unit/javadocjar-failonerror/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/javadocjar-failonerror/target/javadoc-bundle-options</javadocOptionsDir>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ under the License.
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.JavadocJarInvalidDestdirMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<destDir>${basedir}/target/test/unit/javadocjar-invalid-destdir/target/invalid</destDir>
<jarOutputDirectory>${basedir}/target/test/unit/javadocjar-invalid-destdir/target</jarOutputDirectory>
<outputDirectory>${basedir}/target/test/unit/javadocjar-invalid-destdir/target/site/apidocs</outputDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ under the License.
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.Jdk5TestMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<outputDirectory>${basedir}/target/test/unit/jdk5-test/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/jdk5-test/target/javadoc-bundle-options</javadocOptionsDir>
<show>protected</show>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ under the License.
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.Jdk6TestMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<outputDirectory>${basedir}/target/test/unit/jdk6-test/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/jdk6-test/target/javadoc-bundle-options</javadocOptionsDir>
<show>protected</show>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ under the License.
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.NewlineTestMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<outputDirectory>${basedir}/target/test/unit/newline-test/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/newline-test/target/javadoc-bundle-options</javadocOptionsDir>
<show>protected</show>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ under the License.
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.OptionsUmlautEncodingMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<outputDirectory>${basedir}/target/test/unit/optionsumlautencoding-test/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/optionsumlautencoding-test/target/javadoc-bundle-options</javadocOptionsDir>
<breakiterator>false</breakiterator>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ under the License.
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.PomMavenProjectStub"/>
<localRepository>${localRepository}</localRepository>
<outputDirectory>${basedir}/target/test/unit/pom-test/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/pom-test/target/javadoc-bundle-options</javadocOptionsDir>
<show>protected</show>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ under the License.
<configuration>
<project implementation="org.apache.maven.plugins.javadoc.stubs.ProxyTestMavenProjectStub"/>
<settings implementation="org.apache.maven.plugins.javadoc.stubs.SettingsStub"/>
<localRepository>${localRepository}</localRepository>
<outputDirectory>${basedir}/target/test/unit/proxy-test/target/site/apidocs</outputDirectory>
<javadocOptionsDir>${basedir}/target/test/unit/proxy-test/target/javadoc-bundle-options</javadocOptionsDir>
<show>protected</show>
Expand Down
Loading

0 comments on commit 9e13239

Please sign in to comment.