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

[MSHADE-438] Update to Maven 3.2.5 #175

Merged
merged 2 commits into from
Feb 23, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Simplify and fix NPE prone code
First transfort (w/ classifier) and then convert the
artifact.
  • Loading branch information
cstamas committed Feb 22, 2023
commit ee28bc05e70898a16185f0db991358fe6c51235e
18 changes: 10 additions & 8 deletions src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import org.apache.maven.RepositoryUtils;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Exclusion;
Expand Down Expand Up @@ -54,8 +55,6 @@
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.WriterFactory;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.artifact.ArtifactType;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.resolution.ArtifactRequest;
import org.eclipse.aether.resolution.ArtifactResolutionException;
import org.eclipse.aether.resolution.ArtifactResult;
Expand Down Expand Up @@ -842,12 +841,15 @@ private void copyFiles( File source, File target )

private File resolveArtifactForClassifier( Artifact artifact, String classifier )
{
ArtifactType artifactType = session.getRepositorySession().getArtifactTypeRegistry().get( artifact.getType() );
org.eclipse.aether.artifact.DefaultArtifact coordinate = new DefaultArtifact( artifact.getGroupId(),
artifact.getArtifactId(), classifier, artifactType.getExtension(), artifact.getVersion(),
null, artifactType );
ArtifactRequest request = new ArtifactRequest(
coordinate, RepositoryUtils.toRepos( project.getRemoteArtifactRepositories() ), "shade" );
org.eclipse.aether.artifact.Artifact coordinate = RepositoryUtils.toArtifact(
new DefaultArtifact( artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersionRange(),
artifact.getScope(), artifact.getType(), classifier, artifact.getArtifactHandler(),
artifact.isOptional()
)
);

ArtifactRequest request = new ArtifactRequest( coordinate,
RepositoryUtils.toRepos( project.getRemoteArtifactRepositories() ), "shade" );

Artifact resolvedArtifact;
try
Expand Down