Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into dependabot/maven/sl…
Browse files Browse the repository at this point in the history
…f4jVersion-1.7.36
  • Loading branch information
slawekjaranowski committed Apr 17, 2023
2 parents 17f7312 + c4f464a commit abd0fea
Show file tree
Hide file tree
Showing 18 changed files with 68 additions and 105 deletions.
2 changes: 1 addition & 1 deletion maven-plugin-annotations/pom.xml
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>3.8.2-SNAPSHOT</version>
</parent>

<artifactId>maven-plugin-annotations</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-plugin-plugin/pom.xml
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>3.8.2-SNAPSHOT</version>
</parent>

<groupId>org.apache.maven.plugins</groupId>
Expand Down
Expand Up @@ -27,7 +27,6 @@
import java.util.Set;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.filter.ArtifactFilter;
import org.apache.maven.artifact.resolver.filter.IncludesArtifactFilter;
import org.apache.maven.plugin.MojoExecutionException;
Expand All @@ -49,6 +48,7 @@
import org.apache.maven.tools.plugin.scanner.MojoScanner;
import org.codehaus.plexus.component.repository.ComponentDependency;
import org.codehaus.plexus.util.ReaderFactory;
import org.eclipse.aether.RepositorySystemSession;
import org.sonatype.plexus.build.incremental.BuildContext;

/**
Expand Down Expand Up @@ -229,22 +229,8 @@ public class DescriptorGeneratorMojo extends AbstractGeneratorMojo {
@Parameter(defaultValue = "${settings}", readonly = true, required = true)
private Settings settings;

/**
* List of Remote Repositories used by the resolver
*
* @since 3.0
*/
@Parameter(defaultValue = "${project.remoteArtifactRepositories}", required = true, readonly = true)
private List<ArtifactRepository> remoteRepos;

/**
* Location of the local repository.
*
* @since 3.0
*/
@Parameter(defaultValue = "${localRepository}", required = true, readonly = true)
private ArtifactRepository local;

@Parameter(defaultValue = "${repositorySystemSession}", readonly = true, required = true)
private RepositorySystemSession repoSession;
/**
* The required Java version to set in the plugin descriptor. This is evaluated by Maven 4 and ignored by earlier
* Maven versions. Can be either one of the following formats:
Expand Down Expand Up @@ -360,8 +346,7 @@ public void generate() throws MojoExecutionException {
request.setEncoding(encoding);
request.setSkipErrorNoDescriptorsFound(skipErrorNoDescriptorsFound);
request.setDependencies(filterMojoDependencies());
request.setLocal(this.local);
request.setRemoteRepos(this.remoteRepos);
request.setRepoSession(repoSession);
request.setInternalJavadocBaseUrl(internalJavadocBaseUrl);
request.setInternalJavadocVersion(internalJavadocVersion);
request.setExternalJavadocBaseUrls(externalJavadocBaseUrls);
Expand Down
2 changes: 1 addition & 1 deletion maven-plugin-report-plugin/pom.xml
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>3.8.2-SNAPSHOT</version>
</parent>

<groupId>org.apache.maven.plugins</groupId>
Expand Down
2 changes: 1 addition & 1 deletion maven-plugin-tools-annotations/pom.xml
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>3.8.2-SNAPSHOT</version>
</parent>

<artifactId>maven-plugin-tools-annotations</artifactId>
Expand Down
Expand Up @@ -51,16 +51,13 @@
import com.thoughtworks.qdox.model.JavaMember;
import com.thoughtworks.qdox.model.JavaMethod;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.resolver.ArtifactResolutionRequest;
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
import org.apache.maven.artifact.versioning.ComparableVersion;
import org.apache.maven.plugin.descriptor.InvalidParameterException;
import org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.plugin.descriptor.Requirement;
import org.apache.maven.project.MavenProject;
import org.apache.maven.repository.RepositorySystem;
import org.apache.maven.tools.plugin.ExtendedMojoDescriptor;
import org.apache.maven.tools.plugin.PluginToolsRequest;
import org.apache.maven.tools.plugin.extractor.ExtractionException;
Expand All @@ -85,6 +82,11 @@
import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import org.codehaus.plexus.util.StringUtils;
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.objectweb.asm.Opcodes;

/**
Expand Down Expand Up @@ -570,23 +572,26 @@ protected void extendJavaProjectBuilderWithSourcesJar(
JavaProjectBuilder builder, Artifact artifact, PluginToolsRequest request, String classifier)
throws ExtractionException {
try {
Artifact sourcesArtifact = repositorySystem.createArtifactWithClassifier(
org.eclipse.aether.artifact.Artifact sourcesArtifact = new DefaultArtifact(
artifact.getGroupId(),
artifact.getArtifactId(),
artifact.getVersion(),
artifact.getType(),
classifier);

ArtifactResolutionRequest req = new ArtifactResolutionRequest();
req.setArtifact(sourcesArtifact);
req.setLocalRepository(request.getLocal());
req.setRemoteRepositories(request.getRemoteRepos());
ArtifactResolutionResult res = repositorySystem.resolve(req);
if (res.hasMissingArtifacts() || res.hasExceptions()) {
getLogger()
.warn("Unable to get sources artifact for " + artifact.getGroupId() + ":"
+ artifact.getArtifactId() + ":" + artifact.getVersion()
+ ". Some javadoc tags (@since, @deprecated and comments) won't be used");
classifier,
artifact.getArtifactHandler().getExtension(),
artifact.getVersion());

ArtifactRequest resolveRequest =
new ArtifactRequest(sourcesArtifact, request.getProject().getRemoteProjectRepositories(), null);
try {
ArtifactResult result = repositorySystem.resolveArtifact(request.getRepoSession(), resolveRequest);
sourcesArtifact = result.getArtifact();
} catch (ArtifactResolutionException e) {
String message = "Unable to get sources artifact for " + artifact.getId()
+ ". Some javadoc tags (@since, @deprecated and comments) won't be used";
if (getLogger().isDebugEnabled()) {
getLogger().warn(message, e);
} else {
getLogger().warn(message);
}
return;
}

Expand Down
8 changes: 4 additions & 4 deletions maven-plugin-tools-api/pom.xml
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>3.8.2-SNAPSHOT</version>
</parent>

<artifactId>maven-plugin-tools-api</artifactId>
Expand Down Expand Up @@ -62,12 +62,12 @@
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
<version>4.5.14</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.15</version>
<version>4.4.16</version>
</dependency>
<!-- wagon for proxy related classes -->
<dependency>
Expand All @@ -79,7 +79,7 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-java</artifactId>
<version>1.1.1</version>
<version>1.1.2</version>
</dependency>
<!-- test -->
<dependency>
Expand Down
Expand Up @@ -24,12 +24,12 @@
import java.util.Set;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.MavenProject;
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.StringUtils;
import org.eclipse.aether.RepositorySystemSession;

/**
* Default implementation of {@link PluginToolsRequest}, which is used to pass parameters to components used to extract
Expand All @@ -53,9 +53,7 @@ public class DefaultPluginToolsRequest implements PluginToolsRequest {

private Set<Artifact> dependencies;

private List<ArtifactRepository> remoteRepos;

private ArtifactRepository local;
private RepositorySystemSession repoSession;

private URI internalJavadocBaseUrl;

Expand Down Expand Up @@ -162,25 +160,12 @@ public PluginToolsRequest setDependencies(Set<Artifact> dependencies) {
}

@Override
public List<ArtifactRepository> getRemoteRepos() {
return remoteRepos;
}

@Override
public PluginToolsRequest setRemoteRepos(List<ArtifactRepository> remoteRepos) {
this.remoteRepos = remoteRepos;
return this;
}

@Override
public ArtifactRepository getLocal() {
return local;
public RepositorySystemSession getRepoSession() {
return repoSession;
}

@Override
public PluginToolsRequest setLocal(ArtifactRepository local) {
this.local = local;
return this;
public void setRepoSession(RepositorySystemSession repoSession) {
this.repoSession = repoSession;
}

@Override
Expand Down
Expand Up @@ -23,10 +23,10 @@
import java.util.Set;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.MavenProject;
import org.apache.maven.settings.Settings;
import org.eclipse.aether.RepositorySystemSession;

/**
* Request that encapsulates all information relevant to the process of extracting
Expand Down Expand Up @@ -111,37 +111,22 @@ public interface PluginToolsRequest {
PluginToolsRequest setDependencies(Set<Artifact> dependencies);

/**
* Return a Repository Session
*
* @return the remote repositories
* @since 3.0
*/
List<ArtifactRepository> getRemoteRepos();

/**
*
* @param remoteRepos the remote repositories
* @return This request.
* @since 3.0
*/
PluginToolsRequest setRemoteRepos(List<ArtifactRepository> remoteRepos);

/**
*
* @return the local artifact repository
* @since 3.0
* @return a Repository Session
* @since 3.8.2
*/
ArtifactRepository getLocal();
RepositorySystemSession getRepoSession();

/**
* Set a Repository Session
*
* @param local the local repository
* @return This request.
* @since 3.0
* @param repoSession a Repository Session
* @since 3.8.2
*/
PluginToolsRequest setLocal(ArtifactRepository local);
void setRepoSession(RepositorySystemSession repoSession);

/**
*
* @param baseUrl may be relative to the current site's root
* @return This request.
* @since 3.7.0
Expand Down Expand Up @@ -183,7 +168,6 @@ public interface PluginToolsRequest {
List<URI> getExternalJavadocBaseUrls();

/**
*
* @param settings the Maven settings
* @return This request.
* @since 3.7.0
Expand Down
4 changes: 2 additions & 2 deletions maven-plugin-tools-generators/pom.xml
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>3.8.2-SNAPSHOT</version>
</parent>

<artifactId>maven-plugin-tools-generators</artifactId>
Expand Down Expand Up @@ -63,7 +63,7 @@
<!-- other -->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<artifactId>velocity</artifactId>
</dependency>

<dependency>
Expand Down
2 changes: 1 addition & 1 deletion maven-plugin-tools-java/pom.xml
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>3.8.2-SNAPSHOT</version>
</parent>

<artifactId>maven-plugin-tools-java</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-script/maven-plugin-tools-ant/pom.xml
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-script</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>3.8.2-SNAPSHOT</version>
</parent>

<artifactId>maven-plugin-tools-ant</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-script/maven-plugin-tools-beanshell/pom.xml
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-script</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>3.8.2-SNAPSHOT</version>
</parent>

<artifactId>maven-plugin-tools-beanshell</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-script/maven-plugin-tools-model/pom.xml
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-script</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>3.8.2-SNAPSHOT</version>
</parent>

<artifactId>maven-plugin-tools-model</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-script/maven-script-ant/pom.xml
Expand Up @@ -23,7 +23,7 @@ under the License.
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-script</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>3.8.2-SNAPSHOT</version>
</parent>

<artifactId>maven-script-ant</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-script/maven-script-beanshell/pom.xml
Expand Up @@ -23,7 +23,7 @@ under the License.
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-script</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>3.8.2-SNAPSHOT</version>
</parent>

<artifactId>maven-script-beanshell</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-script/pom.xml
Expand Up @@ -23,7 +23,7 @@ under the License.
<parent>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-tools</artifactId>
<version>3.8.0-SNAPSHOT</version>
<version>3.8.2-SNAPSHOT</version>
</parent>

<artifactId>maven-script</artifactId>
Expand Down

0 comments on commit abd0fea

Please sign in to comment.