Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate off ancient Plexus components #31969

Merged
merged 1 commit into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions devtools/maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,8 @@
<artifactId>maven-plugin-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
Expand Down Expand Up @@ -172,16 +168,15 @@
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
<version>2.1.0</version>
<configuration>
<staticMetadataDirectory>${basedir}/target/filtered-resources/META-INF/plexus</staticMetadataDirectory>
</configuration>
<groupId>org.eclipse.sisu</groupId>
<artifactId>sisu-maven-plugin</artifactId>
<version>0.3.5</version>
<executions>
<execution>
<id>index-project</id>
<goals>
<goal>generate-metadata</goal>
<goal>main-index</goal>
<goal>test-index</goal>
</goals>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import io.quarkus.bootstrap.util.IoUtils;
import io.quarkus.bootstrap.workspace.ArtifactSources;
import io.quarkus.maven.dependency.ArtifactCoords;
import io.quarkus.runtime.LaunchMode;

/**
* This goal downloads all the Maven artifact dependencies required to build, run, test and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
import java.util.Set;
import java.util.concurrent.ExecutionException;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Model;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.impl.RemoteRepositoryManager;

Expand All @@ -45,21 +47,26 @@
import io.quarkus.runtime.LaunchMode;
import io.smallrye.common.expression.Expression;

@Component(role = QuarkusBootstrapProvider.class, instantiationStrategy = "singleton")
@Singleton
@Named
public class QuarkusBootstrapProvider implements Closeable {

private static final String MANIFEST_SECTIONS_PROPERTY_PREFIX = "quarkus.package.manifest.manifest-sections";
private static final String MANIFEST_ATTRIBUTES_PROPERTY_PREFIX = "quarkus.package.manifest.attributes";

@Requirement(role = RepositorySystem.class, optional = false)
protected RepositorySystem repoSystem;
private final RepositorySystem repoSystem;

@Requirement(role = RemoteRepositoryManager.class, optional = false)
protected RemoteRepositoryManager remoteRepoManager;
private final RemoteRepositoryManager remoteRepoManager;

private final Cache<String, QuarkusMavenAppBootstrap> appBootstrapProviders = CacheBuilder.newBuilder()
.concurrencyLevel(4).softValues().initialCapacity(10).build();

@Inject
public QuarkusBootstrapProvider(RepositorySystem repoSystem, RemoteRepositoryManager remoteRepoManager) {
this.repoSystem = repoSystem;
this.remoteRepoManager = remoteRepoManager;
}

static ArtifactKey getProjectId(MavenProject project) {
return ArtifactKey.ga(project.getGroupId(), project.getArtifactId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,29 @@

import java.io.IOException;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;

import org.apache.maven.AbstractMavenLifecycleParticipant;
import org.apache.maven.MavenExecutionException;
import org.apache.maven.execution.MavenSession;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;

import io.quarkus.maven.QuarkusBootstrapProvider;

@Component(role = AbstractMavenLifecycleParticipant.class, hint = "quarkus-bootstrap")
@Singleton
@Named("quarkus-bootstrap")
public class BootstrapSessionListener extends AbstractMavenLifecycleParticipant {

@Requirement(optional = false)
protected QuarkusBootstrapProvider bootstrapProvider;
private final QuarkusBootstrapProvider bootstrapProvider;

private boolean enabled;

@Inject
public BootstrapSessionListener(QuarkusBootstrapProvider bootstrapProvider) {
this.bootstrapProvider = bootstrapProvider;
}

@Override
public void afterSessionEnd(MavenSession session) throws MavenExecutionException {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
import java.util.List;
import java.util.Properties;

import javax.inject.Named;

import org.apache.commons.lang3.StringUtils;
import org.apache.maven.artifact.versioning.*;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.logging.Log;
import org.codehaus.plexus.component.annotations.Component;

@Component(role = MavenVersionEnforcer.class, instantiationStrategy = "per-lookup")
@Named
public class MavenVersionEnforcer {

public void ensureMavenVersion(Log log, MavenSession session) throws MojoExecutionException {
Expand Down
17 changes: 10 additions & 7 deletions independent-projects/bootstrap/maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,15 @@
<build>
<plugins>
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
<version>2.1.0</version>
<configuration>
<staticMetadataDirectory>${basedir}/target/filtered-resources/META-INF/plexus</staticMetadataDirectory>
</configuration>
<groupId>org.eclipse.sisu</groupId>
<artifactId>sisu-maven-plugin</artifactId>
<version>0.3.5</version>
<executions>
<execution>
<id>index-project</id>
<goals>
<goal>generate-metadata</goal>
<goal>main-index</goal>
<goal>test-index</goal>
</goals>
</execution>
</executions>
Expand Down Expand Up @@ -101,6 +100,10 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
import java.nio.file.Path;
import java.nio.file.Paths;

import org.codehaus.plexus.component.annotations.Component;
import javax.inject.Named;
import javax.inject.Singleton;

import org.jboss.logging.Logger;

import io.quarkus.bootstrap.resolver.maven.BootstrapMavenException;
import io.quarkus.bootstrap.resolver.maven.options.BootstrapMavenOptions;
import io.quarkus.bootstrap.resolver.maven.workspace.LocalProject;
import io.quarkus.bootstrap.resolver.maven.workspace.LocalWorkspace;

@Component(role = BootstrapWorkspaceProvider.class, instantiationStrategy = "singleton")
@Singleton
@Named
public class BootstrapWorkspaceProvider {

private final Path base;
Expand Down
17 changes: 10 additions & 7 deletions independent-projects/extension-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,15 @@
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
<version>2.1.0</version>
<configuration>
<staticMetadataDirectory>${basedir}/target/filtered-resources/META-INF/plexus</staticMetadataDirectory>
</configuration>
<groupId>org.eclipse.sisu</groupId>
<artifactId>sisu-maven-plugin</artifactId>
<version>0.3.5</version>
<executions>
<execution>
<id>index-project</id>
<goals>
<goal>generate-metadata</goal>
<goal>main-index</goal>
<goal>test-index</goal>
</goals>
</execution>
</executions>
Expand Down Expand Up @@ -251,6 +250,10 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
import java.nio.file.Path;
import java.nio.file.Paths;

import org.codehaus.plexus.component.annotations.Component;
import javax.inject.Named;
import javax.inject.Singleton;

import org.jboss.logging.Logger;

import io.quarkus.bootstrap.resolver.maven.BootstrapMavenException;
import io.quarkus.bootstrap.resolver.maven.options.BootstrapMavenOptions;
import io.quarkus.bootstrap.resolver.maven.workspace.LocalProject;
import io.quarkus.bootstrap.resolver.maven.workspace.LocalWorkspace;

@Component(role = BootstrapWorkspaceProvider.class, instantiationStrategy = "singleton")
@Singleton
@Named
public class BootstrapWorkspaceProvider {

private final Path base;
Expand Down