This is an automated email from the ASF dual-hosted git repository. elharo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-site-plugin.git
The following commit(s) were added to refs/heads/master by this push: new f12b66ce [MSITE-1029] Prefer Guice to Plexus (#215) f12b66ce is described below commit f12b66cec5f4830825b4579a140d89df6e32ca21 Author: Elliotte Rusty Harold <elh...@users.noreply.github.com> AuthorDate: Mon Dec 16 11:39:59 2024 +0000 [MSITE-1029] Prefer Guice to Plexus (#215) * Prefer Guice to Plexus --- .../site/descriptor/SiteDescriptorAttachMojo.java | 27 +++++++++------- .../maven/plugins/site/render/SiteJarMojo.java | 37 ++++++++++++---------- 2 files changed, 37 insertions(+), 27 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/site/descriptor/SiteDescriptorAttachMojo.java b/src/main/java/org/apache/maven/plugins/site/descriptor/SiteDescriptorAttachMojo.java index 9459567b..d416c7a8 100644 --- a/src/main/java/org/apache/maven/plugins/site/descriptor/SiteDescriptorAttachMojo.java +++ b/src/main/java/org/apache/maven/plugins/site/descriptor/SiteDescriptorAttachMojo.java @@ -18,12 +18,13 @@ */ package org.apache.maven.plugins.site.descriptor; +import javax.inject.Inject; + import java.io.File; import java.io.IOException; import java.util.Locale; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -45,19 +46,10 @@ import org.codehaus.plexus.util.FileUtils; */ @Mojo(name = "attach-descriptor", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true) public class SiteDescriptorAttachMojo extends AbstractSiteDescriptorMojo { - /** - */ + @Parameter(property = "basedir", required = true, readonly = true) private File basedir; - /** - * Maven ProjectHelper. - * - * @since 2.1.1 - */ - @Component - private MavenProjectHelper projectHelper; - /** * Attach site descriptor only if packaging is pom. * @since 3.0 @@ -65,6 +57,19 @@ public class SiteDescriptorAttachMojo extends AbstractSiteDescriptorMojo { @Parameter(defaultValue = "true") private boolean pomPackagingOnly; + /** + * Maven ProjectHelper. + * + * @since 2.1.1 + */ + private final MavenProjectHelper projectHelper; + + @Inject + public SiteDescriptorAttachMojo(MavenProjectHelper projectHelper) { + this.projectHelper = projectHelper; + } + + @Override public void execute() throws MojoExecutionException { if (pomPackagingOnly && !"pom".equals(project.getPackaging())) { // https://issues.apache.org/jira/browse/MSITE-597 diff --git a/src/main/java/org/apache/maven/plugins/site/render/SiteJarMojo.java b/src/main/java/org/apache/maven/plugins/site/render/SiteJarMojo.java index 9f3168b2..52acd27e 100644 --- a/src/main/java/org/apache/maven/plugins/site/render/SiteJarMojo.java +++ b/src/main/java/org/apache/maven/plugins/site/render/SiteJarMojo.java @@ -18,6 +18,8 @@ */ package org.apache.maven.plugins.site.render; +import javax.inject.Inject; + import java.io.File; import java.io.IOException; @@ -26,13 +28,11 @@ import org.apache.maven.archiver.MavenArchiver; import org.apache.maven.artifact.DependencyResolutionRequiredException; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.project.MavenProjectHelper; -import org.codehaus.plexus.archiver.Archiver; import org.codehaus.plexus.archiver.ArchiverException; import org.codehaus.plexus.archiver.jar.JarArchiver; import org.codehaus.plexus.archiver.jar.ManifestException; @@ -69,26 +69,12 @@ public class SiteJarMojo extends SiteMojo { @Parameter(property = "project.build.finalName", required = true) private String finalName; - /** - * Used for attaching the artifact in the project. - */ - @Component - private MavenProjectHelper projectHelper; - /** * Specifies whether to attach the generated artifact to the project. */ @Parameter(property = "site.attach", defaultValue = "true") private boolean attach; - /** - * The Jar archiver. - * - * @since 3.1 - */ - @Component(role = Archiver.class, hint = "jar") - private JarArchiver jarArchiver; - /** * The archive configuration to use. * See <a href="http://maven.apache.org/shared/maven-archiver/index.html">Maven Archiver Reference</a>. @@ -116,9 +102,28 @@ public class SiteJarMojo extends SiteMojo { @Parameter private String[] archiveExcludes; + /** + * Used for attaching the artifact in the project. + */ + private final MavenProjectHelper projectHelper; + + /** + * The Jar archiver. + * + * @since 3.1 + */ + private final JarArchiver jarArchiver; + + @Inject + public SiteJarMojo(MavenProjectHelper projectHelper, JarArchiver jarArchiver) { + this.projectHelper = projectHelper; + this.jarArchiver = jarArchiver; + } + /** * @see org.apache.maven.plugin.Mojo#execute() */ + @Override public void execute() throws MojoExecutionException, MojoFailureException { if (skip) { getLog().info("maven.site.skip = true: Skipping jar generation");