Skip to content
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 @@ -30,11 +30,6 @@
import org.apache.maven.artifact.resolver.CyclicDependencyException;
import org.apache.maven.artifact.versioning.OverConstrainedVersionException;

/**
*
*
*
*/
@Deprecated
public class MetadataResolutionResult {
private Artifact originatingArtifact;
Expand All @@ -61,12 +56,8 @@ public class MetadataResolutionResult {

private Set<Artifact> artifacts;

private MetadataGraph dirtyTree;

private MetadataGraph resolvedTree;

private MetadataGraph resolvedGraph;

public Artifact getOriginatingArtifact() {
return originatingArtifact;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public DefaultModelBuilder setProfileActivationFilePathInterpolator(
@SuppressWarnings("checkstyle:methodlength")
@Override
public ModelBuildingResult build(ModelBuildingRequest request) throws ModelBuildingException {
return build(request, new LinkedHashSet<String>());
return build(request, new LinkedHashSet<>());
}

@SuppressWarnings("checkstyle:methodlength")
Expand Down Expand Up @@ -358,14 +358,15 @@ protected ModelBuildingResult build(ModelBuildingRequest request, Collection<Str
currentData.setVersion(null);
currentData = parentData;
} else if (!parentIds.add(parentData.getId())) {
String message = "The parents form a cycle: ";
StringBuilder message = new StringBuilder("The parents form a cycle: ");
for (String modelId : parentIds) {
message += modelId + " -> ";
message.append(modelId);
message.append(" -> ");
}
message += parentData.getId();
message.append(parentData.getId());

problems.add(new ModelProblemCollectorRequest(ModelProblem.Severity.FATAL, ModelProblem.Version.BASE)
.setMessage(message));
.setMessage(message.toString()));

throw problems.newModelBuildingException();
} else {
Expand Down Expand Up @@ -431,7 +432,7 @@ private interface InterpolateString {

private List<Profile> getInterpolatedProfiles(
Model rawModel, DefaultProfileActivationContext context, DefaultModelProblemCollector problems) {
List<Profile> interpolatedActivations = getProfiles(rawModel, true);
List<Profile> interpolatedActivations = getProfiles(rawModel);

if (interpolatedActivations.isEmpty()) {
return Collections.emptyList();
Expand Down Expand Up @@ -496,7 +497,7 @@ void performFor(String value, String locationKey, Consumer<String> mutator) {
@Override
public ModelBuildingResult build(ModelBuildingRequest request, ModelBuildingResult result)
throws ModelBuildingException {
return build(request, result, new LinkedHashSet<String>());
return build(request, result, new LinkedHashSet());
}

private ModelBuildingResult build(
Expand Down Expand Up @@ -754,20 +755,18 @@ private void assembleInheritance(
}
}

private List<Profile> getProfiles(Model model, boolean clone) {
private List<Profile> getProfiles(Model model) {
ArrayList<Profile> profiles = new ArrayList<>();
for (Profile profile : model.getProfiles()) {
if (clone) {
profile = profile.clone();
}
profile = profile.clone();
profiles.add(profile);
}
return profiles;
}

private Model interpolateModel(Model model, ModelBuildingRequest request, ModelProblemCollector problems) {
// save profile activations before interpolation, since they are evaluated with limited scope
List<Profile> originalProfiles = getProfiles(model, true);
List<Profile> originalProfiles = getProfiles(model);

Model interpolatedModel =
modelInterpolator.interpolateModel(model, model.getProjectDirectory(), request, problems);
Expand Down Expand Up @@ -1166,12 +1165,15 @@ private void importDependencyManagement(
String imported = groupId + ':' + artifactId + ':' + version;

if (importIds.contains(imported)) {
String message = "The dependencies of type=pom and with scope=import form a cycle: ";
StringBuilder message =
new StringBuilder("The dependencies of type=pom and with scope=import form a cycle: ");
for (String modelId : importIds) {
message += modelId + " -> ";
message.append(modelId);
message.append(" -> ");
}
message += imported;
problems.add(new ModelProblemCollectorRequest(Severity.ERROR, Version.BASE).setMessage(message));
message.append(imported);
problems.add(
new ModelProblemCollectorRequest(Severity.ERROR, Version.BASE).setMessage(message.toString()));

continue;
}
Expand Down Expand Up @@ -1288,8 +1290,7 @@ private void fireEvent(
Model model,
ModelBuildingRequest request,
ModelProblemCollector problems,
ModelBuildingEventCatapult catapult)
throws ModelBuildingException {
ModelBuildingEventCatapult catapult) {
ModelBuildingListener listener = request.getModelBuildingListener();

if (listener != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
Expand Down Expand Up @@ -464,7 +463,7 @@ private List<Artifact> toMavenArtifacts(DependencyResult dependencyResult) {
return dependencyResult.getDependencyNodeResults().stream()
.filter(n -> n.getArtifact().getPath() != null)
.map(n -> RepositoryUtils.toArtifact(n.getDependency()))
.collect(Collectors.toUnmodifiableList());
.toList();
}

private Map<String, ClassLoader> calcImports(
Expand Down Expand Up @@ -1024,28 +1023,4 @@ private List<Artifact> resolveExtensionArtifacts(
pluginDependenciesResolver.resolvePlugin(extensionPlugin, null, null, repositories, session);
return toMavenArtifacts(root);
}

static class NamedImpl implements Named {
private final String value;

NamedImpl(String value) {
this.value = value;
}

public String value() {
return this.value;
}

public int hashCode() {
return 127 * "value".hashCode() ^ this.value.hashCode();
}

public boolean equals(Object o) {
return o instanceof Named named && this.value.equals(named.value());
}

public Class<? extends Annotation> annotationType() {
return Named.class;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void testUnlimitedNumberOfDigitsInNumericComponent() {
}

@Test
void testTransitionFromDigitToLetterAndViceVersaIsEqualivantToDelimiter() {
void testTransitionFromDigitToLetterAndViceVersaIsEquivalentToDelimiter() {
assertOrder(AbstractVersionTest.X_EQ_Y, "1alpha10", "1.alpha.10");
assertOrder(AbstractVersionTest.X_EQ_Y, "1alpha10", "1-alpha-10");

Expand Down