Skip to content

Commit

Permalink
SiteJarMojo
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo committed Nov 19, 2024
1 parent 31d2dfc commit e3b5497
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions src/main/java/org/apache/maven/plugins/site/render/SiteJarMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.maven.plugins.site.render;

import javax.inject.Inject;

import java.io.File;
import java.io.IOException;

Expand All @@ -26,13 +28,11 @@
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;
Expand Down Expand Up @@ -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>.
Expand Down Expand Up @@ -116,9 +102,28 @@ public class SiteJarMojo extends SiteMojo {
@Parameter
private String[] archiveExcludes;

/**
* Used for attaching the artifact in the project.
*/
private MavenProjectHelper projectHelper;

/**
* The Jar archiver.
*
* @since 3.1
*/
private 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");
Expand Down

0 comments on commit e3b5497

Please sign in to comment.