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-archetype.git
The following commit(s) were added to refs/heads/master by this push: new 7b4c29cb @Component --> @Inject (#243) 7b4c29cb is described below commit 7b4c29cb169087420ed9770939fdb4475bef1e5d Author: Elliotte Rusty Harold <elh...@users.noreply.github.com> AuthorDate: Thu Nov 28 13:19:34 2024 +0000 @Component --> @Inject (#243) * @Component --> @Inject\ --- .../archetype/creator/FilesetArchetypeCreator.java | 11 +++++++--- .../generator/DefaultArchetypeGenerator.java | 22 +++++++++++-------- .../DefaultFilesetArchetypeGenerator.java | 16 ++++++++++---- .../maven/archetype/old/DefaultOldArchetype.java | 8 +++++-- maven-archetype-plugin/pom.xml | 23 +++++++++++++++++++- .../maven/archetype/mojos/CrawlRepositoryMojo.java | 9 ++++++-- .../mojos/CreateArchetypeFromProjectMojo.java | 19 ++++++++++------ .../mojos/CreateProjectFromArchetypeMojo.java | 22 +++++++++++++------ .../maven/archetype/mojos/IntegrationTestMojo.java | 19 +++++++++++----- .../org/apache/maven/archetype/mojos/JarMojo.java | 25 +++++++++------------- .../archetype/mojos/UpdateLocalCatalogMojo.java | 13 +++++++---- .../archetype/ui/DefaultArchetypeFactory.java | 2 +- .../DefaultArchetypeGenerationConfigurator.java | 19 +++++++++++----- .../ui/generation/DefaultArchetypeSelector.java | 9 ++++++-- 14 files changed, 151 insertions(+), 66 deletions(-) diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java b/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java index 846787f6..62c92fc7 100644 --- a/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java +++ b/archetype-common/src/main/java/org/apache/maven/archetype/creator/FilesetArchetypeCreator.java @@ -91,15 +91,20 @@ public class FilesetArchetypeCreator implements ArchetypeCreator { private static final String DEFAULT_OUTPUT_DIRECTORY = "target" + File.separator + "generated-sources" + File.separator + "archetype"; - @Inject private ArchetypeFilesResolver archetypeFilesResolver; - @Inject private PomManager pomManager; - @Inject private Invoker invoker; + @Inject + public FilesetArchetypeCreator( + ArchetypeFilesResolver archetypeFilesResolver, PomManager pomManager, Invoker invoker) { + this.archetypeFilesResolver = archetypeFilesResolver; + this.pomManager = pomManager; + this.invoker = invoker; + } + @Override @SuppressWarnings("checkstyle:MethodLength") public void createArchetype(ArchetypeCreationRequest request, ArchetypeCreationResult result) { diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java b/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java index 0bae553e..5d31008f 100644 --- a/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java +++ b/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultArchetypeGenerator.java @@ -41,26 +41,31 @@ import org.eclipse.aether.RepositorySystem; import org.eclipse.aether.RepositorySystemSession; import org.eclipse.aether.repository.RemoteRepository; import org.eclipse.aether.repository.RepositoryPolicy; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; @Named @Singleton public class DefaultArchetypeGenerator implements ArchetypeGenerator { - private static final Logger LOGGER = LoggerFactory.getLogger(DefaultArchetypeGenerator.class); - @Inject private ArchetypeArtifactManager archetypeArtifactManager; - @Inject private FilesetArchetypeGenerator filesetGenerator; - @Inject private OldArchetype oldArchetype; - @Inject private RepositorySystem repositorySystem; + @Inject + public DefaultArchetypeGenerator( + ArchetypeArtifactManager archetypeArtifactManager, + FilesetArchetypeGenerator filesetGenerator, + OldArchetype oldArchetype, + RepositorySystem repositorySystem) { + this.archetypeArtifactManager = archetypeArtifactManager; + this.filesetGenerator = filesetGenerator; + this.oldArchetype = oldArchetype; + this.repositorySystem = repositorySystem; + } + private File getArchetypeFile(ArchetypeGenerationRequest request) throws ArchetypeException { if (!isArchetypeDefined(request)) { throw new ArchetypeNotDefined("The archetype is not defined"); @@ -68,10 +73,9 @@ public class DefaultArchetypeGenerator implements ArchetypeGenerator { List<RemoteRepository> repos = new ArrayList<>(request.getRemoteRepositories()); - RemoteRepository remoteRepo = null; if (request != null && request.getArchetypeRepository() != null) { RepositorySystemSession repositorySession = request.getRepositorySession(); - remoteRepo = createRepository( + RemoteRepository remoteRepo = createRepository( repositorySession, request.getArchetypeRepository(), request.getArchetypeArtifactId() + "-repo"); repos.add(remoteRepo); diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java b/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java index 8ce51c66..49504bd4 100644 --- a/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java +++ b/archetype-common/src/main/java/org/apache/maven/archetype/generator/DefaultFilesetArchetypeGenerator.java @@ -77,18 +77,26 @@ import org.xml.sax.SAXException; public class DefaultFilesetArchetypeGenerator implements FilesetArchetypeGenerator { private static final Logger LOGGER = LoggerFactory.getLogger(DefaultFilesetArchetypeGenerator.class); - @Inject private ArchetypeArtifactManager archetypeArtifactManager; - @Inject private ArchetypeFilesResolver archetypeFilesResolver; - @Inject private PomManager pomManager; - @Inject private VelocityComponent velocity; + @Inject + public DefaultFilesetArchetypeGenerator( + ArchetypeArtifactManager archetypeArtifactManager, + ArchetypeFilesResolver archetypeFilesResolver, + PomManager pomManager, + VelocityComponent velocity) { + this.archetypeArtifactManager = archetypeArtifactManager; + this.archetypeFilesResolver = archetypeFilesResolver; + this.pomManager = pomManager; + this.velocity = velocity; + } + /** * Pattern used to detect tokens in a string. Tokens are any text surrounded * by the delimiter <code>__</code>. diff --git a/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java b/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java index 07812170..040d2f24 100644 --- a/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java +++ b/archetype-common/src/main/java/org/apache/maven/archetype/old/DefaultOldArchetype.java @@ -88,12 +88,16 @@ public class DefaultOldArchetype implements OldArchetype { // Components // ---------------------------------------------------------------------- - @Inject private VelocityComponent velocity; - @Inject private ArchetypeArtifactManager archetypeArtifactManager; + @Inject + public DefaultOldArchetype(VelocityComponent velocity, ArchetypeArtifactManager archetypeArtifactManager) { + this.archetypeArtifactManager = archetypeArtifactManager; + this.velocity = velocity; + } + // ---------------------------------------------------------------------- // Implementation // ---------------------------------------------------------------------- diff --git a/maven-archetype-plugin/pom.xml b/maven-archetype-plugin/pom.xml index 2fa4bb3b..ad68eba6 100644 --- a/maven-archetype-plugin/pom.xml +++ b/maven-archetype-plugin/pom.xml @@ -30,7 +30,7 @@ <!-- The purpose of having groupId different from other modules is to call mvn archetype:* - w/out the need to add a plugin group in settings + without the need to add a plugin group in settings. --> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-archetype-plugin</artifactId> @@ -119,6 +119,11 @@ <optional>true</optional> </dependency> + <dependency> + <groupId>org.apache.maven.shared</groupId> + <artifactId>maven-shared-utils</artifactId> + <version>3.4.2</version> + </dependency> <dependency> <groupId>org.apache.maven.shared</groupId> <artifactId>maven-invoker</artifactId> @@ -152,12 +157,28 @@ <version>5.4.0</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>1.7.36</version> + </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-simple</artifactId> <version>1.7.36</version> <scope>test</scope> </dependency> + <dependency> + <groupId>javax.inject</groupId> + <artifactId>javax.inject</artifactId> + <version>1</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.eclipse.sisu</groupId> + <artifactId>org.eclipse.sisu.plexus</artifactId> + <scope>provided</scope> + </dependency> </dependencies> <build> 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..475a6140 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,16 @@ 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) { + this.configurator = configurator; + this.manager = manager; + } + @Override public void execute() throws MojoExecutionException { diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java index cfb787c2..6e83ceae 100644 --- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java +++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/CreateProjectFromArchetypeMojo.java @@ -18,6 +18,8 @@ */ package org.apache.maven.archetype.mojos; +import javax.inject.Inject; + import java.io.File; import java.util.Arrays; import java.util.Properties; @@ -32,7 +34,6 @@ import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.ContextEnabled; 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; @@ -55,21 +56,30 @@ import org.eclipse.aether.RepositorySystem; @Mojo(name = "generate", requiresProject = false) @Execute(phase = LifecyclePhase.GENERATE_SOURCES) public class CreateProjectFromArchetypeMojo extends AbstractMojo implements ContextEnabled { - @Component private ArchetypeManager manager; - @Component private ArchetypeSelector selector; - @Component private ArchetypeGenerationConfigurator configurator; - @Component private Invoker invoker; - @Component private RepositorySystem repositorySystem; + @Inject + public CreateProjectFromArchetypeMojo( + ArchetypeManager manager, + ArchetypeSelector selector, + ArchetypeGenerationConfigurator configurator, + Invoker invoker, + RepositorySystem repositorySystem) { + this.manager = manager; + this.selector = selector; + this.configurator = configurator; + this.invoker = invoker; + this.repositorySystem = repositorySystem; + } + /** * The archetype's artifactId. */ diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java index e96975c8..d840f822 100644 --- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java +++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/IntegrationTestMojo.java @@ -18,6 +18,8 @@ */ package org.apache.maven.archetype.mojos; +import javax.inject.Inject; + import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -50,7 +52,6 @@ import org.apache.maven.archetype.ui.generation.ArchetypeGenerationConfigurator; 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.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; @@ -131,18 +132,26 @@ import org.codehaus.plexus.util.xml.XmlStreamWriter; @Mojo(name = "integration-test", requiresProject = true) public class IntegrationTestMojo extends AbstractMojo { - @Component private ArchetypeGenerator archetypeGenerator; - @Component private Downloader downloader; - @Component private Invoker invoker; - @Component private ArchetypeGenerationConfigurator archetypeGenerationConfigurator; + @Inject + public IntegrationTestMojo( + ArchetypeGenerator archetypeGenerator, + Downloader downloader, + Invoker invoker, + ArchetypeGenerationConfigurator archetypeGenerationConfigurator) { + this.archetypeGenerator = archetypeGenerator; + this.downloader = downloader; + this.invoker = invoker; + this.archetypeGenerationConfigurator = archetypeGenerationConfigurator; + } + /** * The archetype project to execute the integration tests on. */ diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/JarMojo.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/JarMojo.java index 599c6609..54301186 100644 --- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/JarMojo.java +++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/mojos/JarMojo.java @@ -18,10 +18,11 @@ */ package org.apache.maven.archetype.mojos; +import javax.inject.Inject; + import java.io.File; import java.util.Map; -import org.apache.maven.archetype.ArchetypeManager; import org.apache.maven.archetype.common.ArchetypeArtifactManager; import org.apache.maven.archetype.exception.UnknownArchetype; import org.apache.maven.archetype.metadata.ArchetypeDescriptor; @@ -31,7 +32,6 @@ import org.apache.maven.archiver.MavenArchiver; 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; @@ -84,12 +84,6 @@ public class JarMojo extends AbstractMojo { @Parameter(defaultValue = "${session}", readonly = true, required = true) private MavenSession session; - /** - * The Jar archiver. - */ - @Component - private Map<String, Archiver> archivers; - /** * The archive configuration to use. See <a href="https://maven.apache.org/shared/maven-archiver/index.html">Maven * Archiver Reference</a>. @@ -110,17 +104,18 @@ public class JarMojo extends AbstractMojo { private String outputTimestamp; /** - * The archetype manager component. + * The Jar archiver. */ - @Component - private ArchetypeManager manager; + private Map<String, Archiver> archivers; - /** - * The archetype artifact manager component. - */ - @Component private ArchetypeArtifactManager archetypeArtifactManager; + @Inject + public JarMojo(Map<String, Archiver> archivers, ArchetypeArtifactManager archetypeArtifactManager) { + this.archivers = archivers; + this.archetypeArtifactManager = archetypeArtifactManager; + } + @Override public void execute() throws MojoExecutionException { File jarFile = new File(outputDirectory, finalName + ".jar"); 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())) { diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeFactory.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeFactory.java index 81568f68..f1f48cc9 100644 --- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeFactory.java +++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/DefaultArchetypeFactory.java @@ -261,7 +261,7 @@ public class DefaultArchetypeFactory implements ArchetypeFactory { } /** - * Check if the given value references a property, ie contains <code>${...}</code>. + * Check if the given value references a property; that is, it contains <code>${...}</code>. * * @param defaultValue the value to check * @return <code>true</code> if the value contains <code>${</code> followed by <code>}</code> diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeGenerationConfigurator.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeGenerationConfigurator.java index 876aebab..ce667d1f 100644 --- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeGenerationConfigurator.java +++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeGenerationConfigurator.java @@ -72,21 +72,30 @@ import org.slf4j.LoggerFactory; public class DefaultArchetypeGenerationConfigurator implements ArchetypeGenerationConfigurator { private static final Logger LOGGER = LoggerFactory.getLogger(DefaultArchetypeGenerationConfigurator.class); - @Inject private ArchetypeArtifactManager archetypeArtifactManager; - @Inject private ArchetypeFactory archetypeFactory; - @Inject private ArchetypeGenerationQueryer archetypeGenerationQueryer; - @Inject private VelocityComponent velocity; - @Inject private RepositorySystem repositorySystem; + @Inject + public DefaultArchetypeGenerationConfigurator( + ArchetypeArtifactManager archetypeArtifactManager, + ArchetypeFactory archetypeFactory, + ArchetypeGenerationQueryer archetypeGenerationQueryer, + VelocityComponent velocity, + RepositorySystem repositorySystem) { + this.archetypeArtifactManager = archetypeArtifactManager; + this.archetypeFactory = archetypeFactory; + this.archetypeGenerationQueryer = archetypeGenerationQueryer; + this.velocity = velocity; + this.repositorySystem = repositorySystem; + } + public void setArchetypeArtifactManager(ArchetypeArtifactManager archetypeArtifactManager) { this.archetypeArtifactManager = archetypeArtifactManager; } diff --git a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeSelector.java b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeSelector.java index 433c3157..afb05b6b 100644 --- a/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeSelector.java +++ b/maven-archetype-plugin/src/main/java/org/apache/maven/archetype/ui/generation/DefaultArchetypeSelector.java @@ -49,12 +49,17 @@ public class DefaultArchetypeSelector implements ArchetypeSelector { static final String DEFAULT_ARCHETYPE_ARTIFACTID = "maven-archetype-quickstart"; - @Inject private ArchetypeSelectionQueryer archetypeSelectionQueryer; - @Inject private ArchetypeManager archetypeManager; + @Inject + public DefaultArchetypeSelector( + ArchetypeSelectionQueryer archetypeSelectionQueryer, ArchetypeManager archetypeManager) { + this.archetypeManager = archetypeManager; + this.archetypeSelectionQueryer = archetypeSelectionQueryer; + } + @Override public void selectArchetype(ArchetypeGenerationRequest request, Boolean interactiveMode, String catalogs) throws PrompterException, ArchetypeSelectionFailure {