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

[MNG-8180] Back out from failing the build #1642

Merged
merged 1 commit into from
Aug 12, 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
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
import org.eclipse.aether.installation.InstallRequest;
import org.eclipse.aether.metadata.Metadata;
import org.eclipse.aether.util.ConfigUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* Maven G level metadata generator.
Expand All @@ -51,6 +53,8 @@
class PluginsMetadataGenerator implements MetadataGenerator {
private static final String PLUGIN_DESCRIPTOR_LOCATION = "META-INF/maven/plugin.xml";

private final Logger logger = LoggerFactory.getLogger(getClass());

private final Map<Object, PluginsMetadata> processedPlugins;

private final Date timestamp;
Expand Down Expand Up @@ -142,20 +146,20 @@ private PluginInfo extractPluginInfo(Artifact artifact) {
// here groupId and artifactId cannot be null
return new PluginInfo(groupId, artifactId, goalPrefix, name);
} else {
throw new InvalidArtifactPluginMetadataException(
"Artifact " + artifact.getGroupId() + ":"
+ artifact.getArtifactId()
+ " JAR (to be installed/deployed) contains Maven Plugin metadata for plugin "
+ groupId + ":" + artifactId + "; coordinates are conflicting. "
+ "Most probably your JAR contains rogue Maven Plugin metadata, "
+ "possible causes may be: shaded in Maven Plugin or some rogue resource)");
logger.warn(
"Artifact {}:{}"
+ " JAR (about to be installed/deployed) contains Maven Plugin metadata for"
+ " conflicting coordinates: {}:{}."
+ " Your JAR contains rogue Maven Plugin metadata."
+ " Possible causes may be: shaded into this JAR some Maven Plugin or some rogue resource.",
artifact.getGroupId(),
artifact.getArtifactId(),
groupId,
artifactId);
}
}
}
} catch (Exception e) {
if (e instanceof InvalidArtifactPluginMetadataException) {
throw (InvalidArtifactPluginMetadataException) e;
}
// here we can have: IO. ZIP or Plexus Conf Ex: but we should not interfere with user intent
}
}
Expand All @@ -170,10 +174,4 @@ private static String mayGetChild(Xpp3Dom node, String child) {
}
return null;
}

public static final class InvalidArtifactPluginMetadataException extends IllegalArgumentException {
InvalidArtifactPluginMetadataException(String s) {
super(s);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,15 @@
*/
package org.apache.maven.repository.internal;

import java.nio.file.Files;
import java.util.Arrays;
import java.util.List;

import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.collection.CollectRequest;
import org.eclipse.aether.collection.CollectResult;
import org.eclipse.aether.graph.Dependency;
import org.eclipse.aether.graph.DependencyNode;
import org.eclipse.aether.installation.InstallRequest;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.resolution.ArtifactDescriptorRequest;