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-655] Get rid of Wagon API to download catalogs #215

Merged
merged 1 commit into from
Sep 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
4 changes: 0 additions & 4 deletions archetype-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-provider-api</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,15 @@
import java.util.List;
import java.util.Properties;

import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectBuildingRequest;

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

private ArtifactRepository localRepository;
private File localRepositoryBasedir;

private MavenProject project;

// private File propertyFile;

private List<String> languages = new ArrayList<>();

private List<String> filtereds = new ArrayList<>();
Expand Down Expand Up @@ -65,27 +60,15 @@ public String getPostPhase() {

public ArchetypeCreationRequest setPostPhase(String postPhase) {
this.postPhase = postPhase;

return this;
}

public ArtifactRepository getLocalRepository() {
return localRepository;
public File getLocalRepositoryBasedir() {
return localRepositoryBasedir;
}

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

return this;
}

public ProjectBuildingRequest getProjectBuildingRequest() {
return projectBuildingRequest;
}

public ArchetypeCreationRequest setProjectBuildingRequest(ProjectBuildingRequest projectBuildingRequest) {
this.projectBuildingRequest = projectBuildingRequest;

public ArchetypeCreationRequest setLocalRepositoryBasedir(File localRepository) {
this.localRepositoryBasedir = localRepository;
return this;
}

Expand All @@ -95,29 +78,15 @@ public MavenProject getProject() {

public ArchetypeCreationRequest setProject(MavenProject project) {
this.project = project;

return this;
}

// public File getPropertyFile()
// {
// return propertyFile;
// }
//
// public ArchetypeCreationRequest setPropertyFile( File propertyFile )
// {
// this.propertyFile = propertyFile;
//
// return this;
// }

public List<String> getLanguages() {
return languages;
}

public ArchetypeCreationRequest setLanguages(List<String> languages) {
this.languages = languages;

return this;
}

Expand All @@ -127,7 +96,6 @@ public List<String> getFiltereds() {

public ArchetypeCreationRequest setFiltereds(List<String> filtereds) {
this.filtereds = filtereds;

return this;
}

Expand All @@ -137,7 +105,6 @@ public String getDefaultEncoding() {

public ArchetypeCreationRequest setDefaultEncoding(String defaultEncoding) {
this.defaultEncoding = defaultEncoding;

return this;
}

Expand All @@ -147,7 +114,6 @@ public boolean isPreserveCData() {

public ArchetypeCreationRequest setPreserveCData(boolean preserveCData) {
this.preserveCData = preserveCData;

return this;
}

Expand All @@ -157,7 +123,6 @@ public boolean isKeepParent() {

public ArchetypeCreationRequest setKeepParent(boolean keepParent) {
this.keepParent = keepParent;

return this;
}

Expand All @@ -167,7 +132,6 @@ public boolean isPartialArchetype() {

public ArchetypeCreationRequest setPartialArchetype(boolean partialArchetype) {
this.partialArchetype = partialArchetype;

return this;
}

Expand All @@ -177,7 +141,6 @@ public Properties getProperties() {

public ArchetypeCreationRequest setProperties(Properties properties) {
this.properties = properties;

return this;
}

Expand All @@ -187,7 +150,6 @@ public String getPackageName() {

public ArchetypeCreationRequest setPackageName(String packageName) {
this.packageName = packageName;

return this;
}

Expand All @@ -197,7 +159,6 @@ public File getOutputDirectory() {

public ArchetypeCreationRequest setOutputDirectory(File outputDirectory) {
this.outputDirectory = outputDirectory;

return this;
}

Expand All @@ -207,7 +168,6 @@ public File getSettingsFile() {

public ArchetypeCreationRequest setSettingsFile(File settingsFile) {
this.settingsFile = settingsFile;

return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@
import java.util.Properties;

import org.apache.maven.archetype.catalog.Archetype;
import org.apache.maven.project.ProjectBuildingRequest;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.repository.RemoteRepository;

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

private RepositorySystemSession repositorySession;

private boolean interactiveMode;

Expand Down Expand Up @@ -87,12 +88,12 @@ public ArchetypeGenerationRequest(Archetype archetype) {
this.archetypeRepository = archetype.getRepository();
}

public ProjectBuildingRequest getProjectBuildingRequest() {
return projectBuildingRequest;
public RepositorySystemSession getRepositorySession() {
return repositorySession;
}

public ArchetypeGenerationRequest setProjectBuildingRequest(ProjectBuildingRequest projectBuildingRequest) {
this.projectBuildingRequest = projectBuildingRequest;
public ArchetypeGenerationRequest setRepositorySession(RepositorySystemSession repoSession) {
this.repositorySession = repoSession;
return this;
}

Expand All @@ -102,7 +103,6 @@ public String getArchetypeGroupId() {

public ArchetypeGenerationRequest setArchetypeGroupId(String archetypeGroupId) {
this.archetypeGroupId = archetypeGroupId;

return this;
}

Expand All @@ -112,7 +112,6 @@ public String getArchetypeArtifactId() {

public ArchetypeGenerationRequest setArchetypeArtifactId(String archetypeArtifactId) {
this.archetypeArtifactId = archetypeArtifactId;

return this;
}

Expand All @@ -122,7 +121,6 @@ public String getArchetypeVersion() {

public ArchetypeGenerationRequest setArchetypeVersion(String archetypeVersion) {
this.archetypeVersion = archetypeVersion;

return this;
}

Expand All @@ -132,7 +130,6 @@ public String getArchetypeGoals() {

public ArchetypeGenerationRequest setArchetypeGoals(String archetypeGoals) {
this.archetypeGoals = archetypeGoals;

return this;
}

Expand All @@ -142,7 +139,6 @@ public String getArchetypeName() {

public ArchetypeGenerationRequest setArchetypeName(String archetypeName) {
this.archetypeName = archetypeName;

return this;
}

Expand Down Expand Up @@ -175,7 +171,6 @@ public String getArtifactId() {

public ArchetypeGenerationRequest setArtifactId(String artifactId) {
this.artifactId = artifactId;

return this;
}

Expand All @@ -185,7 +180,6 @@ public String getGroupId() {

public ArchetypeGenerationRequest setGroupId(String groupId) {
this.groupId = groupId;

return this;
}

Expand All @@ -195,7 +189,6 @@ public String getVersion() {

public ArchetypeGenerationRequest setVersion(String version) {
this.version = version;

return this;
}

Expand All @@ -205,7 +198,6 @@ public String getPackage() {

public ArchetypeGenerationRequest setPackage(String packageName) {
this.packageName = packageName;

return this;
}

Expand All @@ -225,7 +217,6 @@ public String getOutputDirectory() {

public ArchetypeGenerationRequest setOutputDirectory(String outputDirectory) {
this.outputDirectory = outputDirectory;

return this;
}

Expand All @@ -235,7 +226,6 @@ public boolean isInteractiveMode() {

public ArchetypeGenerationRequest setInteractiveMode(boolean interactiveMode) {
this.interactiveMode = interactiveMode;

return this;
}

Expand All @@ -245,7 +235,6 @@ public boolean isAskForDefaultPropertyValues() {

public ArchetypeGenerationRequest setAskForDefaultPropertyValues(boolean askForDefaultPropertyValues) {
this.askForDefaultPropertyValues = askForDefaultPropertyValues;

return this;
}

Expand All @@ -255,7 +244,6 @@ public List<RemoteRepository> getRemoteArtifactRepositories() {

public ArchetypeGenerationRequest setRemoteArtifactRepositories(List<RemoteRepository> remoteArtifactRepositories) {
this.remoteArtifactRepositories = remoteArtifactRepositories;

return this;
}

Expand All @@ -265,7 +253,6 @@ public String getFilter() {

public ArchetypeGenerationRequest setFilter(String filter) {
this.filter = filter;

return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@

import java.io.File;
import java.io.IOException;
import java.util.List;

import org.apache.maven.archetype.catalog.Archetype;
import org.apache.maven.archetype.catalog.ArchetypeCatalog;
import org.apache.maven.artifact.DependencyResolutionRequiredException;
import org.apache.maven.project.ProjectBuildingRequest;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.repository.RemoteRepository;

/** @author Jason van Zyl */
public interface ArchetypeManager {
Expand Down Expand Up @@ -60,19 +62,21 @@ public interface ArchetypeManager {
* if path is a file, it used as is.
* if path is a directory, archetype-catalog.xml is appended to it.
*
* @param buildingRequest the catalog file path or directory containing the catalog file.
* @param repositorySession
* @return the catalog.
*/
ArchetypeCatalog getLocalCatalog(ProjectBuildingRequest buildingRequest);
ArchetypeCatalog getLocalCatalog(RepositorySystemSession repositorySession);

/**
* Gives the catalog of archetypes located at
* <code>https://repo.maven.apache.org/maven2/archetype-catalog.xml</code>.
* @param buildingRequest TODO
*
* @param repositorySession
* @param remoteRepositories
* @return the catalog.
*/
ArchetypeCatalog getRemoteCatalog(ProjectBuildingRequest buildingRequest);
ArchetypeCatalog getRemoteCatalog(
RepositorySystemSession repositorySession, List<RemoteRepository> remoteRepositories);

/**
* Creates a jar file for an archetype.
Expand All @@ -89,5 +93,5 @@ public interface ArchetypeManager {
File archiveArchetype(File archetypeDirectory, File outputDirectory, String finalName)
throws DependencyResolutionRequiredException, IOException;

File updateLocalCatalog(ProjectBuildingRequest buildingRequest, Archetype archetype);
File updateLocalCatalog(RepositorySystemSession repositorySystemSession, Archetype archetype);
}
Loading