-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Structured BuilderProblem pipeline for DiagnosticCollector #12702
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
Open
gnodet
wants to merge
2
commits into
feature/warning-mode
Choose a base branch
from
feature/12643-structured-problems
base: feature/warning-mode
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+3,937
−80
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,30 @@ | ||
| #!/bin/sh | ||
|
|
||
| # 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. | ||
|
|
||
| # ----------------------------------------------------------------------------- | ||
| # Apache Maven Build Log Viewer Script | ||
| # | ||
| # Environment Variable Prerequisites | ||
| # | ||
| # JAVA_HOME (Optional) Points to a Java installation. | ||
| # MAVEN_OPTS (Optional) Java runtime options used when Maven is executed. | ||
| # MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files. | ||
| # ----------------------------------------------------------------------------- | ||
|
|
||
| "`dirname "$0"`/mvn" --log "$@" |
This file contains hidden or 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,39 @@ | ||
| @REM Licensed to the Apache Software Foundation (ASF) under one | ||
| @REM or more contributor license agreements. See the NOTICE file | ||
| @REM distributed with this work for additional information | ||
| @REM regarding copyright ownership. The ASF licenses this file | ||
| @REM to you under the Apache License, Version 2.0 (the | ||
| @REM "License"); you may not use this file except in compliance | ||
| @REM with the License. You may obtain a copy of the License at | ||
| @REM | ||
| @REM http://www.apache.org/licenses/LICENSE-2.0 | ||
| @REM | ||
| @REM Unless required by applicable law or agreed to in writing, | ||
| @REM software distributed under the License is distributed on an | ||
| @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| @REM KIND, either express or implied. See the License for the | ||
| @REM specific language governing permissions and limitations | ||
| @REM under the License. | ||
|
|
||
| @REM ----------------------------------------------------------------------------- | ||
| @REM Apache Maven Build Log Viewer Script | ||
| @REM | ||
| @REM Environment Variable Prerequisites | ||
| @REM | ||
| @REM JAVA_HOME (Optional) Points to a Java installation. | ||
| @REM MAVEN_BATCH_ECHO (Optional) Set to 'on' to enable the echoing of the batch commands. | ||
| @REM MAVEN_BATCH_PAUSE (Optional) set to 'on' to wait for a key stroke before ending. | ||
| @REM MAVEN_OPTS (Optional) Java runtime options used when Maven is executed. | ||
| @REM MAVEN_SKIP_RC (Optional) Flag to disable loading of mavenrc files. | ||
| @REM ----------------------------------------------------------------------------- | ||
|
|
||
| @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' | ||
| @echo off | ||
| @REM set title of command window | ||
| title %0 | ||
| @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' | ||
| @if "%MAVEN_BATCH_ECHO%"=="on" echo %MAVEN_BATCH_ECHO% | ||
|
|
||
| @setlocal | ||
|
|
||
| @call "%~dp0"mvn.cmd --log %* |
This file contains hidden or 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 hidden or 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
115 changes: 115 additions & 0 deletions
115
api/maven-api-cli/src/main/java/org/apache/maven/api/cli/mvnlog/LogOptions.java
This file contains hidden or 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,115 @@ | ||
| /* | ||
| * 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.cli.mvnlog; | ||
|
|
||
| import java.util.Optional; | ||
|
|
||
| import org.apache.maven.api.annotations.Experimental; | ||
| import org.apache.maven.api.cli.Options; | ||
|
|
||
| /** | ||
| * Defines the options specific to the Maven build log viewer tool ({@code mvnlog}). | ||
| * This interface extends the general {@link Options} interface, adding log-viewing options. | ||
| * | ||
| * @since 4.1.0 | ||
| */ | ||
| @Experimental | ||
| public interface LogOptions extends Options { | ||
| /** | ||
| * Whether to show detailed diagnostics (warnings and errors) from the build. | ||
| * | ||
| * @return an {@link Optional} containing {@code true} if diagnostics should be shown | ||
| */ | ||
| Optional<Boolean> diagnostics(); | ||
|
|
||
| /** | ||
| * Whether to show detailed failure information including stack traces. | ||
| * | ||
| * @return an {@link Optional} containing {@code true} if failures should be shown in detail | ||
| */ | ||
| Optional<Boolean> failures(); | ||
|
|
||
| /** | ||
| * Whether to show a full per-mojo timing breakdown. | ||
| * | ||
| * @return an {@link Optional} containing {@code true} if the full breakdown should be shown | ||
| */ | ||
| Optional<Boolean> full(); | ||
|
|
||
| /** | ||
| * Whether to list all available build reports instead of showing one. | ||
| * | ||
| * @return an {@link Optional} containing {@code true} if reports should be listed | ||
| */ | ||
| Optional<Boolean> list(); | ||
|
|
||
| /** | ||
| * Whether to output the raw JSON build report instead of formatted text. | ||
| * Useful for piping to tools like {@code jq} or for programmatic consumption. | ||
| * | ||
| * @return an {@link Optional} containing {@code true} if raw JSON should be output | ||
| */ | ||
| Optional<Boolean> json(); | ||
|
|
||
| /** | ||
| * Returns the path to a specific build report file to display. | ||
| * If not specified, defaults to {@code target/build-reports/build-report-latest.json}. | ||
| * | ||
| * @return an {@link Optional} containing the report file path, or empty if not specified | ||
| */ | ||
| Optional<String> reportFile(); | ||
|
|
||
| /** | ||
| * Filter output to a specific module (by artifactId substring or glob pattern). | ||
| * When specified, only modules whose {@code artifactId} contains the given string | ||
| * (case-insensitive) are shown. With {@code --json}, only matching modules | ||
| * are included in the output. | ||
| * | ||
| * @return an {@link Optional} containing the module filter pattern | ||
| */ | ||
| Optional<String> module(); | ||
|
|
||
| /** | ||
| * Filter output to a specific mojo (by goal substring or glob pattern). | ||
| * When specified, only mojos whose {@code goal} contains the given string | ||
| * (case-insensitive) are shown. | ||
| * | ||
| * @return an {@link Optional} containing the mojo filter pattern | ||
| */ | ||
| Optional<String> mojo(); | ||
|
|
||
| /** | ||
| * Filter log events by minimum level ({@code TRACE}, {@code DEBUG}, {@code INFO}, | ||
| * {@code WARN}, {@code ERROR}). Only events at or above the given severity are shown. | ||
| * In text mode, renders matching log lines from the build report. | ||
| * With {@code --json}, filters the log event arrays in the output. | ||
| * | ||
| * @return an {@link Optional} containing the minimum log level | ||
| */ | ||
| Optional<String> level(); | ||
|
|
||
| /** | ||
| * Search through log messages for a substring (case-insensitive). | ||
| * In text mode, renders matching log lines from the build report. | ||
| * With {@code --json}, filters the log event arrays in the output. | ||
| * | ||
| * @return an {@link Optional} containing the grep pattern | ||
| */ | ||
| Optional<String> grep(); | ||
| } |
95 changes: 95 additions & 0 deletions
95
impl/maven-cli/src/main/java/org/apache/maven/cling/MavenLogCling.java
This file contains hidden or 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,95 @@ | ||
| /* | ||
| * 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.cling; | ||
|
|
||
| import java.io.IOException; | ||
| import java.io.InputStream; | ||
| import java.io.OutputStream; | ||
|
|
||
| import org.apache.maven.api.annotations.Nullable; | ||
| import org.apache.maven.api.cli.Invoker; | ||
| import org.apache.maven.api.cli.Parser; | ||
| import org.apache.maven.api.cli.ParserRequest; | ||
| import org.apache.maven.cling.invoker.ProtoLookup; | ||
| import org.apache.maven.cling.invoker.mvnlog.LogInvoker; | ||
| import org.apache.maven.cling.invoker.mvnlog.LogParser; | ||
| import org.codehaus.plexus.classworlds.ClassWorld; | ||
|
|
||
| /** | ||
| * Maven build log viewer CLI ("new-gen"). | ||
| * <p> | ||
| * Displays formatted summaries of previous Maven build reports. | ||
| * Invoked via {@code mvnlog} or {@code mvn --log}. | ||
| * | ||
| * @since 4.1.0 | ||
| */ | ||
| public class MavenLogCling extends ClingSupport { | ||
| /** | ||
| * "Normal" Java entry point. Note: Maven uses ClassWorld Launcher and this entry point is NOT used under normal | ||
| * circumstances. | ||
| */ | ||
| public static void main(String[] args) throws IOException { | ||
| int exitCode = new MavenLogCling().run(args, null, null, null, false); | ||
| System.exit(exitCode); | ||
| } | ||
|
|
||
| /** | ||
| * ClassWorld Launcher "enhanced" entry point: returning exitCode and accepts Class World. | ||
| */ | ||
| public static int main(String[] args, ClassWorld world) throws IOException { | ||
| return new MavenLogCling(world).run(args, null, null, null, false); | ||
| } | ||
|
|
||
| /** | ||
| * ClassWorld Launcher "embedded" entry point: returning exitCode and accepts Class World and streams. | ||
| */ | ||
| public static int main( | ||
| String[] args, | ||
| ClassWorld world, | ||
| @Nullable InputStream stdIn, | ||
| @Nullable OutputStream stdOut, | ||
| @Nullable OutputStream stdErr) | ||
| throws IOException { | ||
| return new MavenLogCling(world).run(args, stdIn, stdOut, stdErr, true); | ||
| } | ||
|
|
||
| public MavenLogCling() { | ||
| super(); | ||
| } | ||
|
|
||
| public MavenLogCling(ClassWorld classWorld) { | ||
| super(classWorld); | ||
| } | ||
|
|
||
| @Override | ||
| protected Invoker createInvoker() { | ||
| return new LogInvoker( | ||
| ProtoLookup.builder().addMapping(ClassWorld.class, classWorld).build(), null); | ||
| } | ||
|
|
||
| @Override | ||
| protected Parser createParser() { | ||
| return new LogParser(); | ||
| } | ||
|
|
||
| @Override | ||
| protected ParserRequest.Builder createParserRequestBuilder(String[] args) { | ||
| return ParserRequest.mvnlog(args, createMessageBuilderFactory()); | ||
| } | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Medium — Windows parity gap] The Unix
mvnscript strips routing flags (--debug,--yjp,--enc,--shell,--up,--log) from$@before exec (lines 316-327), but the Windows.cmdpasses%*unmodified. Runningmvn --log validateon Windows will pass--logthrough to Commons CLI, where it can collide with--log-filevia prefix matching.Windows batch's
%*cannot be modified byshift, so equivalent stripping logic would need aforloop to rebuild the argument list.