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

[ARCHETYPE-660] Require Maven 3.6.3 #205

Merged
merged 1 commit into from
Aug 18, 2024
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
32 changes: 15 additions & 17 deletions archetype-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,6 @@
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-invoker</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-aether-provider</artifactId>
<version>3.0</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-artifact-transfer</artifactId>
Expand All @@ -120,11 +114,6 @@
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<artifactId>aether-impl</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-velocity</artifactId>
Expand Down Expand Up @@ -153,25 +142,34 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<artifactId>aether-connector-file</artifactId>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-connector-basic</artifactId>
<version>${resolverVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<artifactId>aether-connector-wagon</artifactId>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-transport-file</artifactId>
<version>${resolverVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-http</artifactId>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-transport-http</artifactId>
<version>${resolverVersion}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-matchers</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.36</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.apache.maven.project.DefaultProjectBuildingRequest;
import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.repository.internal.MavenRepositorySystemSession;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.LocalRepositoryManager;

public class DefaultArchetypeGeneratorTest extends AbstractMojoTestCase {
// archetypes prepared by antrun execution (see pom.xml) from src/test/archetypes
Expand Down Expand Up @@ -518,7 +521,8 @@ protected void setUp() throws Exception {
assertNotNull(getVariableValueFromObject(generator, "filesetGenerator"));
}

private ArchetypeGenerationRequest createArchetypeGenerationRequest(String project, Archetype archetype) {
private ArchetypeGenerationRequest createArchetypeGenerationRequest(String project, Archetype archetype)
throws ComponentLookupException {
outputDirectory = getBasedir() + "/target/test-classes/projects/" + project;

projectDirectory = new File(outputDirectory, "file-value");
Expand All @@ -540,8 +544,11 @@ private ArchetypeGenerationRequest createArchetypeGenerationRequest(String proje
request.setProperties(ADDITIONAL_PROPERTIES);

ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest();
MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession();
repositorySession.setLocalRepositoryManager(new SimpleLocalRepositoryManager(localRepository.getBasedir()));
DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
RepositorySystem repositorySystem = lookup(RepositorySystem.class);
LocalRepositoryManager localRepositoryManager = repositorySystem.newLocalRepositoryManager(
repositorySession, new LocalRepository(localRepository.getBasedir()));
repositorySession.setLocalRepositoryManager(localRepositoryManager);
buildingRequest.setRepositorySession(repositorySession);
request.setProjectBuildingRequest(buildingRequest);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,17 @@
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.project.DefaultProjectBuildingRequest;
import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.repository.internal.MavenRepositorySystemSession;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.context.Context;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.codehaus.plexus.velocity.VelocityComponent;
import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.LocalRepositoryManager;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.xmlunit.matchers.CompareMatcher.isIdenticalTo;
Expand All @@ -63,6 +66,11 @@
public class ArchetypeTest extends PlexusTestCase {
private OldArchetype archetype;

@Override
protected void customizeContainerConfiguration(ContainerConfiguration configuration) {
configuration.setClassPathScanning("index");
}

public void testArchetype() throws Exception {
FileUtils.deleteDirectory(getTestFile("target/quickstart"));

Expand All @@ -89,8 +97,11 @@ public void testArchetype() throws Exception {

ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest();
buildingRequest.setRemoteRepositories(remoteRepositories);
MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession();
repositorySession.setLocalRepositoryManager(new SimpleLocalRepositoryManager(localRepository.getBasedir()));
DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
RepositorySystem repositorySystem = lookup(RepositorySystem.class);
LocalRepositoryManager localRepositoryManager = repositorySystem.newLocalRepositoryManager(
repositorySession, new LocalRepository(localRepository.getBasedir()));
repositorySession.setLocalRepositoryManager(localRepositoryManager);
buildingRequest.setRepositorySession(repositorySession);

ArchetypeGenerationRequest request = new ArchetypeGenerationRequest()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,20 @@
import org.apache.maven.archetype.catalog.io.xpp3.ArchetypeCatalogXpp3Writer;
import org.apache.maven.project.DefaultProjectBuildingRequest;
import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.repository.internal.MavenRepositorySystemSession;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.PlexusTestCase;
import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.LocalRepositoryManager;

public class LocalCatalogArchetypeDataSourceTest extends PlexusTestCase {

@Override
protected void customizeContainerConfiguration(ContainerConfiguration configuration) {
configuration.setClassPathScanning("index");
}

@Override
protected void setUp() throws Exception {
super.setUp();
Expand All @@ -75,11 +83,13 @@ protected void setUp() throws Exception {

public void testLocalCatalog() throws Exception {
ArchetypeManager archetype = lookup(ArchetypeManager.class);
RepositorySystem repositorySystem = lookup(RepositorySystem.class);

ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest();
MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession();
repositorySession.setLocalRepositoryManager(
new SimpleLocalRepositoryManager(getTestFile("target/test-classes/repositories/test-catalog")));
DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
LocalRepositoryManager localRepositoryManager = repositorySystem.newLocalRepositoryManager(
repositorySession, new LocalRepository(getTestFile("target/test-classes/repositories/test-catalog")));
repositorySession.setLocalRepositoryManager(localRepositoryManager);
buildingRequest.setRepositorySession(repositorySession);

ArchetypeCatalog result = archetype.getLocalCatalog(buildingRequest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,22 @@
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.project.DefaultProjectBuildingRequest;
import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.repository.internal.MavenRepositorySystemSession;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.LocalRepositoryManager;

/** @author Jason van Zyl */
public class ArchetypeGenerationTest extends PlexusTestCase {

@Override
protected void customizeContainerConfiguration(ContainerConfiguration configuration) {
configuration.setClassPathScanning("index");
}

public void testProjectGenerationFromAnArchetype() throws Exception {
ArchetypeManager archetype = (ArchetypeManager) lookup(ArchetypeManager.ROLE);

Expand All @@ -53,9 +62,12 @@ public void testProjectGenerationFromAnArchetype() throws Exception {
"local-repo");

ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest();
MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession();
repositorySession.setLocalRepositoryManager(
new SimpleLocalRepositoryManager("target/test-classes/repositories/central"));
DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
RepositorySystem repositorySystem = lookup(RepositorySystem.class);
LocalRepositoryManager localRepositoryManager = repositorySystem.newLocalRepositoryManager(
repositorySession, new LocalRepository("target/test-classes/repositories/central"));
repositorySession.setLocalRepositoryManager(localRepositoryManager);

buildingRequest.setRepositorySession(repositorySession);

ArchetypeCatalog catalog = archetype.getLocalCatalog(buildingRequest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.project.DefaultProjectBuildingRequest;
import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.repository.internal.MavenRepositorySystemSession;
import org.codehaus.plexus.ContainerConfiguration;
import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.util.FileUtils;
import org.sonatype.aether.impl.internal.SimpleLocalRepositoryManager;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.LocalRepositoryManager;

/**
*
Expand All @@ -43,6 +46,11 @@
public class InternalCatalogArchetypesVerificationTest extends PlexusTestCase {
private static final String CENTRAL = "https://repo.maven.apache.org/maven2";

@Override
protected void customizeContainerConfiguration(ContainerConfiguration configuration) {
configuration.setClassPathScanning("index");
}

public void testInternalCatalog() throws Exception {
ArtifactRepository localRepository = createRepository(
new File(getBasedir(), "target/test-classes/repositories/local")
Expand Down Expand Up @@ -82,14 +90,17 @@ public void testInternalCatalog() throws Exception {
.setLocalRepository(localRepository);

ProjectBuildingRequest buildingRequest = new DefaultProjectBuildingRequest();
MavenRepositorySystemSession repositorySession = new MavenRepositorySystemSession();
repositorySession.setLocalRepositoryManager(new SimpleLocalRepositoryManager(localRepository.getBasedir()));
DefaultRepositorySystemSession repositorySession = new DefaultRepositorySystemSession();
RepositorySystem repositorySystem = lookup(RepositorySystem.class);
LocalRepositoryManager localRepositoryManager = repositorySystem.newLocalRepositoryManager(
repositorySession, new LocalRepository(localRepository.getBasedir()));
repositorySession.setLocalRepositoryManager(localRepositoryManager);
buildingRequest.setRepositorySession(repositorySession);
request.setProjectBuildingRequest(buildingRequest);

ArchetypeGenerationResult generationResult = archetype.generateProjectFromArchetype(request);

assertTrue("Archetype wasn't generated successfully", generationResult.getCause() == null);
assertNull("Archetype wasn't generated successfully", generationResult.getCause());

count++;
}
Expand Down
4 changes: 0 additions & 4 deletions maven-archetype-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@
<artifactId>commons-lang3</artifactId>
<version>3.14.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-velocity</artifactId>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
Expand Down
33 changes: 6 additions & 27 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@

<properties>
<maven.archetype.scm.devConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-archetype.git</maven.archetype.scm.devConnection>
<mavenVersion>3.0</mavenVersion>
<mavenVersion>3.6.3</mavenVersion>
<resolverVersion>1.4.1</resolverVersion>
<wagonVersion>3.3.3</wagonVersion>
<!-- provided by Maven core -->
<javaVersion>8</javaVersion>
Expand Down Expand Up @@ -212,7 +213,7 @@
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
<version>2.1</version>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
Expand All @@ -226,33 +227,11 @@
<version>${wagonVersion}</version>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<artifactId>aether-api</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<artifactId>aether-impl</artifactId>
<version>1.7</version>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-api</artifactId>
<version>${resolverVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<artifactId>aether-spi</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<artifactId>aether-connector-file</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.sonatype.aether</groupId>
<artifactId>aether-connector-wagon</artifactId>
<version>1.7</version>
</dependency>

<!-- Deprecated -->
<dependency>
Expand Down