Skip to content

Commit

Permalink
[ARCHETYPE-673] Get rid of maven-artifact-transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
slawekjaranowski committed Aug 29, 2024
1 parent 8656530 commit 6ec9bf1
Show file tree
Hide file tree
Showing 22 changed files with 186 additions and 544 deletions.
4 changes: 0 additions & 4 deletions archetype-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-invoker</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-artifact-transfer</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,25 @@
*/
package org.apache.maven.archetype;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Properties;

import org.apache.maven.archetype.catalog.Archetype;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Server;
import org.apache.maven.wagon.events.TransferListener;
import org.eclipse.aether.repository.RemoteRepository;

/** @author Jason van Zyl */
public class ArchetypeGenerationRequest {
private ProjectBuildingRequest projectBuildingRequest;

private boolean offline;

private boolean interactiveMode;

private boolean askForDefaultPropertyValues;

private TransferListener transferListener;

private String outputDirectory;

private ArtifactRepository localRepository;

private List<ArtifactRepository> remoteArtifactRepositories;

private Proxy activeProxy;

private List<Server> servers = new ArrayList<>();

private List<Mirror> mirrors = new ArrayList<>();
private List<RemoteRepository> remoteArtifactRepositories = Collections.emptyList();

// Archetype definition
private String archetypeName;
Expand Down Expand Up @@ -235,16 +219,6 @@ public ArchetypeGenerationRequest setProperties(Properties additionalProperties)
return this;
}

public ArtifactRepository getLocalRepository() {
return localRepository;
}

public ArchetypeGenerationRequest setLocalRepository(ArtifactRepository localRepository) {
this.localRepository = localRepository;

return this;
}

public String getOutputDirectory() {
return outputDirectory;
}
Expand Down Expand Up @@ -275,71 +249,11 @@ public ArchetypeGenerationRequest setAskForDefaultPropertyValues(boolean askForD
return this;
}

public boolean isOffline() {
return offline;
}

public ArchetypeGenerationRequest setOffline(boolean offline) {
this.offline = offline;

return this;
}

public TransferListener getTransferListener() {
return transferListener;
}

public ArchetypeGenerationRequest setTransferListener(TransferListener transferListener) {
this.transferListener = transferListener;

return this;
}

public Proxy getActiveProxy() {
return activeProxy;
}

public ArchetypeGenerationRequest setActiveProxy(Proxy activeProxy) {
this.activeProxy = activeProxy;

return this;
}

public ArchetypeGenerationRequest addMirror(Mirror mirror) {
mirrors.add(mirror);

return this;
}

public List<Mirror> getMirrors() {
return mirrors;
}

/**
* @deprecated Use {@link #addServer(Server)} instead
*/
@Deprecated
public ArchetypeGenerationRequest addMirror(Server server) {
return addServer(server);
}

public ArchetypeGenerationRequest addServer(Server server) {
servers.add(server);

return this;
}

public List<Server> getServers() {
return servers;
}

public List<ArtifactRepository> getRemoteArtifactRepositories() {
public List<RemoteRepository> getRemoteArtifactRepositories() {
return remoteArtifactRepositories;
}

@SuppressWarnings("checkstyle:linelength")
public ArchetypeGenerationRequest setRemoteArtifactRepositories(
List<ArtifactRepository> remoteArtifactRepositories) {
public ArchetypeGenerationRequest setRemoteArtifactRepositories(List<RemoteRepository> remoteArtifactRepositories) {
this.remoteArtifactRepositories = remoteArtifactRepositories;

return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,22 @@

import org.apache.maven.archetype.exception.UnknownArchetype;
import org.apache.maven.archetype.metadata.ArchetypeDescriptor;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.model.Model;
import org.apache.maven.project.ProjectBuildingRequest;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.repository.RemoteRepository;

public interface ArchetypeArtifactManager {
String ROLE = ArchetypeArtifactManager.class.getName();

Model getArchetypePom(File jar) throws XmlPullParserException, UnknownArchetype, IOException;

/**
* @param buildingRequest TODO
*/
File getArchetypeFile(
String groupId,
String artifactId,
String version,
ArtifactRepository archetypeRepository,
ArtifactRepository localRepository,
List<ArtifactRepository> repositories,
ProjectBuildingRequest buildingRequest)
List<RemoteRepository> repositories,
RepositorySystemSession repositorySystemSession)
throws UnknownArchetype;

/**
Expand All @@ -60,45 +55,16 @@ File getArchetypeFile(
*/
boolean isFileSetArchetype(File archetypeFile);

/**
* @param buildingRequest TODO
*/
boolean isFileSetArchetype(
String groupId,
String artifactId,
String version,
ArtifactRepository archetypeRepository,
ArtifactRepository localRepository,
List<ArtifactRepository> repositories,
ProjectBuildingRequest buildingRequest);

/**
*/
boolean isOldArchetype(File archetypeFile);

/**
* @param buildingRequest TODO
*/
boolean isOldArchetype(
String groupId,
String artifactId,
String version,
ArtifactRepository archetypeRepository,
ArtifactRepository localRepository,
List<ArtifactRepository> repositories,
ProjectBuildingRequest buildingRequest);

/**
* @param buildingRequest TODO
*/
boolean exists(
String archetypeGroupId,
String archetypeArtifactId,
String archetypeVersion,
ArtifactRepository archetypeRepository,
ArtifactRepository localRepository,
List<ArtifactRepository> repos,
ProjectBuildingRequest buildingRequest);
List<RemoteRepository> repos,
RepositorySystemSession repositorySystemSession);

/**
* Get the archetype file's post-generation script content, read as UTF-8 content.
Expand All @@ -114,19 +80,6 @@ boolean exists(
*/
ArchetypeDescriptor getFileSetArchetypeDescriptor(File archetypeFile) throws UnknownArchetype;

/**
* @param buildingRequest TODO
*/
ArchetypeDescriptor getFileSetArchetypeDescriptor(
String groupId,
String artifactId,
String version,
ArtifactRepository archetypeRepository,
ArtifactRepository localRepository,
List<ArtifactRepository> repositories,
ProjectBuildingRequest buildingRequest)
throws UnknownArchetype;

/**
*/
List<String> getFilesetArchetypeResources(File archetypeFile) throws UnknownArchetype;
Expand All @@ -135,17 +88,4 @@ ArchetypeDescriptor getFileSetArchetypeDescriptor(
*/
org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor getOldArchetypeDescriptor(File archetypeFile)
throws UnknownArchetype;

/**
* @param buildingRequest TODO
*/
org.apache.maven.archetype.old.descriptor.ArchetypeDescriptor getOldArchetypeDescriptor(
String groupId,
String artifactId,
String version,
ArtifactRepository archetypeRepository,
ArtifactRepository localRepository,
List<ArtifactRepository> repositories,
ProjectBuildingRequest buildingRequest)
throws UnknownArchetype;
}
Loading

0 comments on commit 6ec9bf1

Please sign in to comment.