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-8141][MNG-8147] Restore profile ID invariance but warn if duplicate IDs present #1568

Merged
merged 3 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public List<ModelProblem> getProblems() {
return Collections.unmodifiableList(result.getProblems());
}

public static String toMessage(ModelBuildingResult result) {
private static String toMessage(ModelBuildingResult result) {
if (result != null && !result.getModelIds().isEmpty()) {
return toMessage(result.getModelIds().get(0), result.getProblems());
}
Expand All @@ -137,7 +137,7 @@ private static String toMessage(String modelId, List<ModelProblem> problems) {
writer.print(problems.size());
writer.print((problems.size() == 1) ? " problem was " : " problems were ");
writer.print("encountered while building the effective model");
if (modelId != null && !modelId.isEmpty()) {
if (modelId != null && modelId.length() > 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is weird

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just rolled back unrelated change, this is how it is on maven-3.9.x to make (now) unrelated change gone.

writer.print(" for ");
writer.print(modelId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.apache.maven.model.building.ModelBuildingRequest;
import org.apache.maven.model.building.ModelBuildingResult;
import org.apache.maven.model.building.ModelProblem;
import org.apache.maven.model.building.ModelProblemUtils;
import org.apache.maven.model.resolution.UnresolvableModelException;
import org.eclipse.aether.RepositoryEvent;
import org.eclipse.aether.RepositoryEvent.EventType;
Expand Down Expand Up @@ -291,18 +292,19 @@ private Model loadPom(
// ModelBuildingEx is thrown only on FATAL and ERROR severities, but we still can have WARNs
// that may lead to unexpected build failure, log them
if (!modelResult.getProblems().isEmpty()) {
List<ModelProblem> problems = modelResult.getProblems();
logger.warn(
"{} {} encountered while building the effective model for {}",
problems.size(),
(problems.size() == 1) ? "problem was" : "problems were",
request.getArtifact());
if (logger.isDebugEnabled()) {
String message = ModelBuildingException.toMessage(modelResult);
if (message != null) {
logger.warn(message);
for (ModelProblem problem : problems) {
logger.warn(
"{} @ {}",
problem.getMessage(),
ModelProblemUtils.formatLocation(problem, null));
}
} else {
List<ModelProblem> problems = modelResult.getProblems();
logger.warn(
"{} {} encountered while building the effective model for {}",
problems.size(),
(problems.size() == 1) ? "problem was" : "problems were",
request.getArtifact());
}
}
model = modelResult.getEffectiveModel();
Expand Down