Drop MAT (#8182)
* Drop MAT As Maven 3.0 is not being supported, no need for artifical indirection between sonatype/eclipse package for resolver. * Drop unused property * Stabilize dependencies Declare all the used deps, as MAT is removed, and usage has changed to resolver API (so declare it). Plexus Utils is used as well, so declare it explicitly.
This commit is contained in:
parent
2dfbea1bc4
commit
fb4c6228c1
|
@ -49,6 +49,7 @@
|
|||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<argLine>-Dstop.port=@{test.stopPort} -Djetty.port=@{test.jettyPort}</argLine>
|
||||
|
@ -114,11 +115,6 @@
|
|||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.shared</groupId>
|
||||
<artifactId>maven-artifact-transfer</artifactId>
|
||||
<version>${maven-artifact-transfer.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
|
@ -150,6 +146,16 @@
|
|||
<artifactId>maven-core</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.resolver</groupId>
|
||||
<artifactId>maven-resolver-api</artifactId>
|
||||
<version>${maven.resolver.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||
<artifactId>maven-plugin-tools-api</artifactId>
|
||||
|
|
|
@ -45,8 +45,8 @@ import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
|||
import org.apache.maven.plugins.annotations.Component;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.eclipse.aether.RepositorySystem;
|
||||
import org.eclipse.jetty.maven.plugin.utils.MavenProjectHelper;
|
||||
import org.eclipse.jetty.security.LoginService;
|
||||
import org.eclipse.jetty.server.RequestLog;
|
||||
|
@ -357,7 +357,7 @@ public abstract class AbstractWebAppMojo extends AbstractMojo
|
|||
*
|
||||
*/
|
||||
@Component
|
||||
private ArtifactResolver artifactResolver;
|
||||
private RepositorySystem repositorySystem;
|
||||
|
||||
/**
|
||||
* The current maven session
|
||||
|
@ -410,7 +410,7 @@ public abstract class AbstractWebAppMojo extends AbstractMojo
|
|||
}
|
||||
|
||||
getLog().info("Configuring Jetty for project: " + getProjectName());
|
||||
mavenProjectHelper = new MavenProjectHelper(project, artifactResolver, remoteRepositories, session);
|
||||
mavenProjectHelper = new MavenProjectHelper(project, repositorySystem, remoteRepositories, session);
|
||||
mergedSystemProperties = mergeSystemProperties();
|
||||
configureSystemProperties();
|
||||
augmentPluginClasspath();
|
||||
|
|
|
@ -25,15 +25,16 @@ import java.util.Set;
|
|||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.maven.RepositoryUtils;
|
||||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
import org.apache.maven.project.DefaultProjectBuildingRequest;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.project.ProjectBuildingRequest;
|
||||
import org.apache.maven.shared.transfer.artifact.DefaultArtifactCoordinate;
|
||||
import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolver;
|
||||
import org.apache.maven.shared.transfer.artifact.resolve.ArtifactResolverException;
|
||||
import org.eclipse.aether.RepositorySystem;
|
||||
import org.eclipse.aether.artifact.DefaultArtifact;
|
||||
import org.eclipse.aether.resolution.ArtifactRequest;
|
||||
import org.eclipse.aether.resolution.ArtifactResolutionException;
|
||||
import org.eclipse.aether.resolution.ArtifactResult;
|
||||
import org.eclipse.jetty.maven.plugin.OverlayManager;
|
||||
import org.eclipse.jetty.maven.plugin.WarPluginInfo;
|
||||
|
||||
|
@ -46,7 +47,7 @@ import org.eclipse.jetty.maven.plugin.WarPluginInfo;
|
|||
public class MavenProjectHelper
|
||||
{
|
||||
private MavenProject project;
|
||||
private ArtifactResolver artifactResolver;
|
||||
private RepositorySystem repositorySystem;
|
||||
private List<ArtifactRepository> remoteRepositories;
|
||||
private MavenSession session;
|
||||
private final Map<String, MavenProject> artifactToReactorProjectMap;
|
||||
|
@ -62,14 +63,14 @@ public class MavenProjectHelper
|
|||
|
||||
/**
|
||||
* @param project the project being built
|
||||
* @param artifactResolver a resolve for artifacts
|
||||
* @param repositorySystem a resolve for artifacts
|
||||
* @param remoteRepositories repositories from which to resolve artifacts
|
||||
* @param session the current maven build session
|
||||
*/
|
||||
public MavenProjectHelper(MavenProject project, ArtifactResolver artifactResolver, List<ArtifactRepository> remoteRepositories, MavenSession session)
|
||||
public MavenProjectHelper(MavenProject project, RepositorySystem repositorySystem, List<ArtifactRepository> remoteRepositories, MavenSession session)
|
||||
{
|
||||
this.project = project;
|
||||
this.artifactResolver = artifactResolver;
|
||||
this.repositorySystem = repositorySystem;
|
||||
this.remoteRepositories = remoteRepositories;
|
||||
this.session = session;
|
||||
//work out which dependent projects are in the reactor
|
||||
|
@ -145,26 +146,18 @@ public class MavenProjectHelper
|
|||
* @param version the version of the artifact to resolve
|
||||
* @param type the type of the artifact to resolve
|
||||
* @return a File representing the location of the artifact or null if not resolved
|
||||
* @throws ArtifactResolverException
|
||||
* @throws ArtifactResolutionException
|
||||
*/
|
||||
public File resolveArtifact(String groupId, String artifactId, String version, String type)
|
||||
throws ArtifactResolverException
|
||||
throws ArtifactResolutionException
|
||||
{
|
||||
DefaultArtifactCoordinate coordinate = new DefaultArtifactCoordinate();
|
||||
coordinate.setGroupId(groupId);
|
||||
coordinate.setArtifactId(artifactId);
|
||||
coordinate.setVersion(version);
|
||||
coordinate.setExtension(type);
|
||||
ArtifactRequest request = new ArtifactRequest();
|
||||
request.setRepositories(RepositoryUtils.toRepos(remoteRepositories));
|
||||
request.setArtifact(new DefaultArtifact(groupId, artifactId, "", type, version));
|
||||
ArtifactResult result = repositorySystem.resolveArtifact(session.getRepositorySession(), request);
|
||||
|
||||
ProjectBuildingRequest buildingRequest =
|
||||
new DefaultProjectBuildingRequest(session.getProjectBuildingRequest());
|
||||
|
||||
buildingRequest.setRemoteRepositories(remoteRepositories);
|
||||
|
||||
Artifact a = artifactResolver.resolveArtifact(buildingRequest, coordinate).getArtifact();
|
||||
|
||||
if (a != null)
|
||||
return a.getFile();
|
||||
if (result.isResolved())
|
||||
return result.getArtifact().getFile();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
1
pom.xml
1
pom.xml
|
@ -106,7 +106,6 @@
|
|||
<logback.version>1.3.0-alpha16</logback.version>
|
||||
<mariadb.version>3.0.5</mariadb.version>
|
||||
<mariadb.docker.version>10.3.6</mariadb.docker.version>
|
||||
<maven-artifact-transfer.version>0.13.1</maven-artifact-transfer.version>
|
||||
<maven.resolver.version>1.8.1</maven.resolver.version>
|
||||
<maven.version>3.8.4</maven.version>
|
||||
<mongodb.version>3.12.11</mongodb.version>
|
||||
|
|
Loading…
Reference in New Issue