-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…1970) Toned down the Maven4 sec dispatcher messages. Also, IF maven3 passwords detected AND there was `.mvn/extensions.xml` the warnings were doubled. Examples: Failure to start Maven (due non-decryptable passwords): ``` $ mvn clean [ERROR] Error executing Maven. [ERROR] Error building settings * FATAL: Could not decrypt password (fix the corrupted password or remove it, if unused) {xL6L/HbmrY++sNkphnq3fguYepTpM04WlIXb8nB1pk=} * WARNING: Detected 2 pre-Maven 4 legacy encrypted password(s) - configure password encryption with the help of mvnenc for increased security. $ ``` Warning at start (due Maven3 passwords): ``` $ mvn clean [INFO] [INFO] Some problems were encountered while building the effective settings (use -X to see details) [INFO] [INFO] Scanning for projects... [INFO] -------------------------------------------------------------------------------------------------------------------------- [INFO] Reactor Build Order: [INFO] [INFO] Apache Maven ... ``` --- https://issues.apache.org/jira/browse/MNG-8424 https://issues.apache.org/jira/browse/MNG-8419
- Loading branch information
Showing
8 changed files
with
118 additions
and
43 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
api/maven-api-core/src/main/java/org/apache/maven/api/services/MavenBuilderException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.maven.api.services; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Comparator; | ||
import java.util.List; | ||
|
||
import org.apache.maven.api.annotations.Experimental; | ||
|
||
/** | ||
* Base class for all maven exceptions carrying {@link BuilderProblem}s. | ||
* | ||
* @since 4.0.0 | ||
*/ | ||
@Experimental | ||
public abstract class MavenBuilderException extends MavenException { | ||
|
||
private final List<BuilderProblem> problems; | ||
|
||
public MavenBuilderException(String message, Throwable cause) { | ||
super(message, cause); | ||
problems = List.of(); | ||
} | ||
|
||
public MavenBuilderException(String message, List<BuilderProblem> problems) { | ||
super(buildMessage(message, problems), null); | ||
this.problems = problems; | ||
} | ||
|
||
/** | ||
* Formats message out of problems: problems are sorted (in natural order of {@link BuilderProblem.Severity}) | ||
* and then a list is built. These exceptions are usually thrown in "fatal" cases (and usually prevent Maven | ||
* from starting), and these exceptions may end up very early on output. | ||
*/ | ||
protected static String buildMessage(String message, List<BuilderProblem> problems) { | ||
StringBuilder msg = new StringBuilder(message); | ||
ArrayList<BuilderProblem> sorted = new ArrayList<>(problems); | ||
sorted.sort(Comparator.comparing(BuilderProblem::getSeverity)); | ||
for (BuilderProblem problem : sorted) { | ||
msg.append("\n * ") | ||
.append(problem.getSeverity().name()) | ||
.append(": ") | ||
.append(problem.getMessage()); | ||
} | ||
return msg.toString(); | ||
} | ||
|
||
public List<BuilderProblem> getProblems() { | ||
return problems; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters