This is an automated email from the ASF dual-hosted git repository. elharo pushed a commit to branch sisu in repository https://gitbox.apache.org/repos/asf/maven-archetype.git
commit 9cfeb606c9703592a1adeda57f0c3e4c85a16f4e Author: Elliotte Rusty Harold <elh...@ibiblio.org> AuthorDate: Thu Nov 21 17:50:28 2024 -0500 @Component --> @Inject --- .../maven/archetype/mojos/CrawlRepositoryMojo.java | 9 +++++++-- .../archetype/mojos/CreateArchetypeFromProjectMojo.java | 16 +++++++++------- .../maven/archetype/mojos/UpdateLocalCatalogMojo.java | 13 +++++++++---- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CrawlRepositoryMojo.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CrawlRepositoryMojo.java index df752445..1faf8ccc 100644 --- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CrawlRepositoryMojo.java +++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CrawlRepositoryMojo.java @@ -18,13 +18,14 @@ */ package org.apache.maven.archetype.mojos; +import javax.inject.Inject; + import java.io.File; import org.apache.maven.archetype.catalog.ArchetypeCatalog; import org.apache.maven.archetype.repositorycrawler.RepositoryCrawler; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -41,9 +42,13 @@ public class CrawlRepositoryMojo extends AbstractMojo { @Parameter(property = "catalog") private File catalogFile; - @Component private RepositoryCrawler crawler; + @Inject + public CrawlRepositoryMojo(RepositoryCrawler crawler) { + this.crawler = crawler; + } + /** * The repository to crawl. */ diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java index f5db439e..0afcf41d 100644 --- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java +++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.java @@ -18,6 +18,8 @@ */ package org.apache.maven.archetype.mojos; +import javax.inject.Inject; + import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -33,7 +35,6 @@ import org.apache.maven.archetype.ui.creation.ArchetypeCreationConfigurator; import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.Execute; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; @@ -99,18 +100,12 @@ import org.codehaus.plexus.util.StringUtils; @Execute(phase = LifecyclePhase.GENERATE_SOURCES) public class CreateArchetypeFromProjectMojo extends AbstractMojo { - @Component - private ArchetypeCreationConfigurator configurator; - /** * Enable the interactive mode to define the archetype from the project. */ @Parameter(property = "interactive", defaultValue = "false") private boolean interactive; - @Component - private ArchetypeManager manager; - /** * File extensions which are checked for project's text files (vs binary files). */ @@ -218,6 +213,13 @@ public class CreateArchetypeFromProjectMojo extends AbstractMojo { @Parameter(defaultValue = "${session}", readonly = true, required = true) private MavenSession session; + private ArchetypeCreationConfigurator configurator; + + private ArchetypeManager manager; + + @Inject + public CreateArchetypeFromProjectMojo(ArchetypeCreationConfigurator configurator, ArchetypeManager manager) {} + @Override public void execute() throws MojoExecutionException { diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/UpdateLocalCatalogMojo.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/UpdateLocalCatalogMojo.java index 127d1d57..c2bbf74c 100644 --- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/UpdateLocalCatalogMojo.java +++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/UpdateLocalCatalogMojo.java @@ -18,6 +18,8 @@ */ package org.apache.maven.archetype.mojos; +import javax.inject.Inject; + import java.io.File; import org.apache.maven.archetype.ArchetypeManager; @@ -26,7 +28,6 @@ import org.apache.maven.archetype.common.Constants; import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.AbstractMojo; 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; @@ -43,15 +44,19 @@ public class UpdateLocalCatalogMojo extends AbstractMojo { @Parameter(defaultValue = "${session}", readonly = true, required = true) private MavenSession session; - @Component - private ArchetypeManager manager; - /** * The archetype project to add/update to the local catalog. */ @Parameter(defaultValue = "${project}", readonly = true, required = true) private MavenProject project; + private ArchetypeManager manager; + + @Inject + public UpdateLocalCatalogMojo(ArchetypeManager manager) { + this.manager = manager; + } + @Override public void execute() throws MojoExecutionException { if (!Constants.MAVEN_ARCHETYPE_PACKAGING.equalsIgnoreCase(project.getPackaging())) {