Commit Graph

979 Commits

Author SHA1 Message Date
Guillaume Nodet 0c37cff681
[MNG-7820] Get rid of plexus-utils Os class (#1249) 2023-09-22 08:01:36 +02:00
Guillaume Nodet 34b0591f03
[MNG-7820] Remove dependency on plexus-utils StringUtils / FileUtils (#1243)
Co-authored-by: crazyhzm <crazyhzm@apache.org>
2023-09-14 13:48:15 +02:00
Hervé Boutemy 25488f9231 [MNG-7875] colorize transfer messages 2023-09-11 19:06:37 +02:00
Guillaume Nodet 46fd5e9586
Add ModelLocator#locateExistingPom to abstract a bit more (#1237) 2023-09-11 18:15:00 +02:00
Guillaume Nodet 0b3246381d
Remove useless @author tags (#1226)
This information is usually more accurately given by the GIT history
2023-09-06 10:39:32 +02:00
huazhongming 7d66d19f8b
[MNG-7822] Add support for TRACE logging level (with style "bold,magenta") (#1215)
Signed-off-by: crazyhzm <crazyhzm@apache.org>
2023-08-25 17:51:43 +02:00
Guillaume Nodet f2593b97ef
[MNG-7862] The ModelLocator should always be used when locating pom.xml (#1217) 2023-08-23 21:25:14 +02:00
Tamas Cservenak 36db1e35ca
[MNG-7846] Break out of endless loop (#1206)
This is most probably "just" about broken Throwable implementations.
Some override getCause but does not perform checks to what it was inited
as "this" means "not yet inited" actually.

---

https://issues.apache.org/jira/browse/MNG-7846
2023-07-19 17:37:28 +02:00
Guillaume Nodet 9b12ccdeb0
Rename Type#getName() to getId() and improve javadoc (#1198) 2023-07-06 09:20:03 +02:00
Guillaume Nodet 6b3989ce5b Use model processor when locating the root pom when using -f/--file 2023-07-05 15:45:15 +02:00
Guillaume Nodet 08e996bb28 Fix search for topDirectory when using -f / --file 2023-07-04 08:36:08 +02:00
Guillaume Nodet e39142b77a
[MNG-7830] Switch from plexus-xml to stax / woodstox (#1185) 2023-06-29 12:03:50 +02:00
Guillaume Nodet 09b0436828 Fix javadoc for MessageUtils and Style 2023-06-23 16:21:36 +02:00
Hervé Boutemy c080f64d46 update logging documentation 2023-06-19 23:09:43 +02:00
Guillaume Nodet 229b31b626
[MNG-4645] Move Central repo definition out of Maven's core so it can be more easily changed (#1139)
Co-authored-by: Christian Schulte <schulte@apache.org>
2023-06-19 17:04:04 +02:00
Guillaume Nodet e6303aae32
[MNG-5659] Provide project-specific settings located in ${session.rootdir}/.mvn/settings.xml by default (#1059) 2023-06-19 12:32:14 +02:00
Guillaume Nodet 45721a4c9b Fix possible NPE 2023-06-16 13:38:46 +02:00
Karl Heinz Marbaise 5ebbb8ff50
[MNG-7764] Small code improvements (#1088) 2023-06-16 10:54:09 +02:00
Guillaume Nodet a2d435b74a
Get rid of maven-shared-utils (#1158)
Given maven-shared-utils is being deprecated (see MSHARED-1269), we need to remove its usage in maven.  Maven core only uses the logging/message related classes from maven-shared-utils, so this PR enhance the initial v4 api with the needed interfaces and move the jansi specific code into maven-embedder.
2023-06-15 16:51:32 +02:00
Martin Kanters ac0bc5541e
[MNG-7338] Automatically activate batch-mode and make output quiet when running in CI. (#869) 2023-06-08 15:44:17 +02:00
Guillaume Nodet c124554316
[MNG-7698] Support comments in maven.config (#1134) 2023-06-04 07:10:57 +02:00
Guillaume Nodet b2953c52d5
[MNG-7795] IllegalArgumentException: 'other' has different root during plugin validation (#1133)
Checks the paths before relativizing them.
Normalize and relative before adding to result
Rename local vars
Apply to ExecutionEventLogger

---

https://issues.apache.org/jira/browse/MNG-7795

Co-authored-by: Andreas Dangel <adangel@apache.org>
2023-06-01 19:05:48 +02:00
Guillaume Nodet ba3d3516eb
[MNG-7796] Be lenient when using toRealPath (#1130) 2023-05-31 09:40:42 +02:00
Tim te Beek a8319821a9
[MNG-6829] Replace any StringUtils#isEmpty(String) and #isNotEmpty(String) (#1104)
* [MNG-6829] Replace any StringUtils#isEmpty(String) and #isNotEmpty(String)

Use this link to re-run the recipe: https://public.moderne.io/recipes/org.openrewrite.java.migrate.apache.commons.lang.IsNotEmptyToJdk?organizationId=QXBhY2hlIE1hdmVu

Co-authored-by: Moderne <team@moderne.io>

* Apply Spotless

---------

Co-authored-by: Moderne <team@moderne.io>
2023-05-09 19:46:02 -04:00
Guillaume Nodet a1fa3eb534
[MNG-6303] Interpolate all arguments using system and user supplied properties (#1062) 2023-05-05 15:12:12 +02:00
Tamas Cservenak bec53b34e3
[MNG-7038] Fixes for topDirectory (#1100)
Changes:
* resolve file argument against workingDirectory explicitly
* the check Files.isRegularFile should happen against path
2023-05-02 20:37:56 +02:00
Guillaume Nodet 2db7c85b64
[MNG-7038] Introduce public properties to point to the root and top directories of (multi-module) project (#1061)
This commit introduces three properties:

 * project.rootDirectory: the project's directory or parent directory containing a .mvn subdirectory or a pom.xml flagged with the root="true" attribute. If no such directory can be found, accessing the rootDirectory property will throw an IllegalStateException.

 * session.topDirectory : the directory of the topmost project being built, usually the current directory or the directory pointed at by the -f/--file command line argument. The topDirectory is similar to the executionRootDirectory property available on the session, but renamed to make it coherent with the new rootDirectory and to avoid using root in its name. The topDirectory property is computed by the CLI as the directory pointed at by the -f/--file command line argument, or the current directory if there's no such argument.

 * session.rootDirectory : the rootDirectory for the topDirectory project.

The topDirectory and rootDirectory properties are made available on the MavenSession / Session and deprecate the executionRootDirectory and multiModuleProjectDirectory properties. The rootDirectory should never change for a given project and is thus made available for profile activation and model interpolation (without the project. prefix, similar to basedir). The goal is also to make the rootDirectory property also available during command line arguments interpolation.

A root boolean attribute is also added to the model to indicate that the project is the root project. This attribute is only supported if the buildconsumer feature is active and removed before the pom is installed or deployed. It can be used as an alternative mechanism to the .mvn directory.
2023-04-20 12:58:12 +02:00
Karl Heinz Marbaise c49c4e0b18
[MNG-7451] - Remove public modifier from test methods / test classes 2023-04-15 19:24:20 +02:00
Guillaume Nodet b2ee29e03e [MNG-6825] Get rid of commons-lang 2023-04-06 10:51:18 +02:00
Guillaume Nodet 26056b9b20 [MNG-7756] The degree of concurrency does not support "2." as a factor
Also fix the thrown exception to report valid syntaxes without assuming the user intent (for example "0.5c" would say it's not an int...)
2023-04-06 10:51:18 +02:00
Elliotte Rusty Harold cadeab53f6
MNG-7738 don't dump raw stack traces to System.err (#1064) 2023-03-22 12:44:37 +00:00
Tim te Beek 703f814e34
[MNG-6825] Replace FileUtils with Commons IO (#1067)
* [MNG-6825] Replace FileUtils with Commons IO

Co-authored-by: Moderne <team@moderne.io>

* Minor fixes and reverts where cases are not handled yet

* Drop explicit dependencies on plexus-utils

---------

Co-authored-by: Moderne <team@moderne.io>
2023-03-19 20:19:22 +00:00
Elliotte Rusty Harold 2d85d13ee8
MNG-7724 don't warn about unsupported SLF4J configs; no one cares (#1051) 2023-03-11 19:13:02 +00:00
Guillaume Nodet 10128b4484
Remove references to Xpp3DomBuilder and use XmlNodeBuilder instead (#1045) 2023-03-09 16:26:58 +01:00
Tamas Cservenak da64ee9c91
[MNG-7713] Make Maven fail if option present (#1021) (#1022)
As with previous PR (simple removal) the `-llr` got
interpreted as `-l lr`, it logged all output to `lr`
file. This would maean that use of `-llr` would still
sneakily 'work' and probably cause surprise down the
road to users.

Returned the option, and expicitly checking for it's
presence to be able to fail with meaningful message.

---

https://issues.apache.org/jira/browse/MNG-7713
2023-03-01 13:51:51 +01:00
Tamas Cservenak afc1a2bd86
[MNG-7713] Drop legacy-local-repository option (#1020)
There is really no need for it, and there is a resolver option if really must (but really should not, local repo is and should be considered as transient).

---

https://issues.apache.org/jira/browse/MNG-7713
2023-03-01 11:17:55 +01:00
Andrey Bruykhov b17c968a0b Close stream with try-with-resources
This closes #997
2023-02-17 20:59:36 +01:00
Andrey Bruykhov 6e25a2674b [MNG-7686] Speed up by replacing non-pattern #replaceAll() with #replace() or precompiled patterns
This closes #984
2023-02-07 21:55:12 +01:00
Guillaume Nodet a00a44f75b
[MNG-7660] Rename Dom to XmlNode in the v4 api (#946)
* Rename Dom to XmlNode and Xpp3Dom to XmlNodeImpl
* Use XmlNodeBuilder instead of DomBuilder
2023-01-03 16:52:23 +01:00
Michael Osipov c2c6dd0921 Add TODO about property source of maven.repo.local 2023-01-01 20:00:18 +01:00
Hervé Boutemy fbdf109b34
[MNG-7571] add Maven API javadoc (#830) 2022-12-31 17:32:07 +01:00
Michael Osipov 5af08d0052 [MNG-7651] Simplify and document merge of maven.config file and CLI args
This closes #939
2022-12-29 21:27:59 +01:00
Guillaume Nodet 8150c62749 [MNG-7650] Reformat 2022-12-26 16:12:32 +01:00
Guillaume Nodet 4e38415b67
[MNG-7624] Use groupId:artifactId instead of empty goal (#911) 2022-12-15 21:18:29 +01:00
Konrad Windszus ce18c56206
[MNG-7598] Enforce binary backwards-compatibility (#874)
For now only enabled in core and plugin-api

Co-authored-by: Guillaume Nodet <gnodet@gmail.com>
2022-12-15 10:50:39 +01:00
Guillaume Nodet dc47da4366
[MNG-7618] Use goalPrefix instead of artifactId 4to display mojos being executed (#898) 2022-12-05 16:46:15 +01:00
Guillaume Nodet de19cfcd2b [MNG-7601] Reformat sources 2022-11-22 14:26:01 +01:00
Michael Osipov 9c60138915 [MNG-7556] Clean up notion between user properties and system properties
This closes #810
2022-10-29 20:44:15 +02:00
Martin Kanters c178b2fc1a
[MNG-7098] Keep the project counter intact when resuming a multi-module project. (#804) 2022-10-14 10:29:08 +02:00
Guillaume Nodet 3f90e7028e
Restore compatibility on SettingsBuilder, ToolchainsBuilder and MojoDescriptorCreator (#820) 2022-10-11 16:31:57 +02:00
Guillaume Nodet 2a9f39336c
[MNG-7553] New clean API with immutable model (#703) 2022-10-02 10:41:25 +02:00
Martin Kanters 1ca65c79fa Revert "[MNG-7098] Keep the project counter intact when resuming a multi-module project."
This reverts commit 4a06f1f5c3.
2022-09-16 14:51:55 +02:00
Martin Kanters 4a06f1f5c3 [MNG-7098] Keep the project counter intact when resuming a multi-module project. 2022-09-16 14:38:44 +02:00
Marc Wrobel 8125b3131f Fix typos in code
Fix minor typos in code :

- test method names,
- method parameter names,
- variable names.
2022-07-19 00:45:13 +02:00
Marc Wrobel 5ce5591ae3 Fix minor typos
Fix various minor typos in :

- project documentations,
- javadoc and comments,
- test files.
2022-07-18 19:22:19 +02:00
Josef Cacek 03b1faff7e [MNG-7511] Ensure the degreeOfConcurrency is a positive number in MavenExecutionRequest
This closes #767
2022-07-18 13:35:27 +02:00
Hervé Boutemy 4e88d62ab2 [MNG-7501] add relative path to pom.xml in module build start output 2022-06-26 18:46:20 +02:00
Guillaume Nodet 415eaf31de
[MNG-7160] Ability to customize core extensions classloaders (#616) 2022-06-15 10:43:17 +02:00
Christoph Läubrich 2798ee9196 [MNG-7395] Support interpolation in extensions.xml
This adds support for property interpolation in extensions.xml to allow
advanced use cases where one wants to contribute certain things via the
commandline.

This closes #665
2022-02-19 22:01:10 +01:00
Giovanni van der Schelde 4476026c52 [MNG-7217] Update Commons CLI to version 1.5.0
Closes #605
2022-01-08 19:57:39 +01:00
Guillaume Nodet b4773576a8 [MNG-6326] Make the build fail if core extensions can not be loaded (#648) 2022-01-07 10:03:15 +01:00
Guillaume Nodet 3a06530dbc
Remove duplicate call to longOpt (#626) 2021-12-02 11:43:23 +01:00
Julian de Bruin 98a6c4f14c [MNG-7340] Option fail-on-severity takes one argument
Closes #620
2021-11-25 11:35:01 +01:00
Giovanni van der Schelde f43f9f8a3b [MNG-7332] No longer support --define
The reason is that it is broken in Commons CLI and -D just works.
We don't want to work around symptoms. Another point is that
java(1) does not have --define either so we'd like to keep that
consistent.

Closes #611.
2021-11-15 10:46:27 +01:00
Michael Osipov 2c37a7a38e Simplify args help 2021-10-17 12:44:14 +02:00
Hervé Boutemy f46a9131d5 fix javadoc errors 2021-10-17 12:07:50 +02:00
Arturo Bernal d61fcf7da1 [MNG-7288] Remove redundant local variables
Closes #569
2021-10-10 12:42:12 +02:00
Tamas Cservenak c3962c1a6c
[MNG-7278] Clean up core logging (#562)
We had all kind of Loggers in Core, some Plexus
injected, some acquired using SLF4J LoggerFactory,
some static, some final, etc.

This PR aligns all those uses to SLF4J finals.

Notices:
* maven-core does NOT use Plexus Logger anymore
* did not touch maven-compat
2021-10-02 20:33:55 +02:00
Guillaume Nodet 35e5a4d71d [MNG-5577] Use JSR 330 constructor injection
# Conflicts:
#	maven-core/src/main/java/org/apache/maven/lifecycle/internal/DefaultLifecyclePluginAnalyzer.java
2021-10-02 12:26:22 +02:00
Michael Osipov a2a3df3d02 [MNG-7203] Introduce a long option --verbose and deprecate --debug
This closes #519
2021-08-01 22:33:33 +02:00
Michael Osipov 0696cf14ad [MNG-7131] maven.config doesn't handle arguments with spaces in them
Since we don't have a clear specification of the file format change
reading of the file to a one-arg-per-line basis just like Java's
@argfiles or Python's argparse would handle it.
Consider that jvm.config suffers from the same issue its parsing is not
portable between Bourne shell and Windows Command prompt.
2021-07-21 14:31:12 +02:00
Michael Osipov 1fc605dd69 [MNG-7181] Make --version support -q 2021-07-03 19:17:19 +02:00
Michael Osipov a70828c737 [MNG-7180] Make --color option behave more like BSD/GNU grep's --color option 2021-07-03 18:28:31 +02:00
Guillaume Nodet a20230829c [MNG-6915] Adapt the logging width to the terminal width, including sensible limits.
Slightly modified version of e47d647eee
2021-05-22 10:49:42 +02:00
Guillaume Nodet 3e917677e4 [MNG-7032] Evaluate --help and --version after configuring the logging/color 2021-05-06 09:54:43 +02:00
Guillaume Nodet 59c5466c40 [MNG-7080] Add a --color option to simplify color support 2021-05-06 09:54:03 +02:00
Guillaume Nodet 5d6c6e2537 [MNG-6915] Format help according to the terminal width 2021-05-05 08:34:32 +02:00
Martin Kanters 9c631ab286 Extend mvn -h for various features of Maven 4
Closes #463.
2021-04-05 19:41:28 +02:00
Carlos Chacin 276c6a8dc4 [MNG-7127] fix MavenCliTest.testStyleColors test in JDK 16
The MavenCliTest.testStyleColors is not failing when the build
is under JDK 8 or JDK 11.

After changing to JDK 16, the test fails, this commit is to fix
the NullPointerException.

Tested on JDK 8, 11 adn 16 with:

`mvn clean verify`
2021-03-27 19:15:18 +01:00
Maarten Mulders c3cf29438e [MNG-6511] Optional project selection
Closes #446.
2021-03-22 14:41:59 +01:00
Hervé Boutemy 441cf73c06 improve documentation 2021-02-20 19:34:43 +01:00
Guillaume Nodet 619973b91c [MNG-7063] Infinite loop using Shade plugin and JUnit 5 dependency
Signed-off-by: rfscholte <rfscholte@apache.org>
2021-02-14 15:52:04 +01:00
Maarten Mulders 8defd16965 [MNG-7051] Optionally skip non-existing profiles and break on missing required profiles. 2021-02-02 08:20:21 +01:00
Guillaume Nodet bb916d0784 [MNG-7035] Migrate unit tests to Unit 5
Signed-off-by: rfscholte <rfscholte@apache.org>
2021-01-15 15:07:06 +01:00
Sylwester Lachiewicz b877445cb9 [MNG-6909] Convert to JSR330 in tests - maven-core
Closes #346
2021-01-08 03:55:24 +01:00
Michael Osipov a6d5e86155 Use consistent static final loggers 2021-01-05 15:47:20 +01:00
Michael Osipov 2201698234 Apply consistent log argument quoting for sigle- and multi-valued args 2021-01-05 15:47:20 +01:00
Karl Heinz Marbaise 538de4d192 [MNG-6888] Remove deprecated command line options
This closes #418
2021-01-01 20:57:23 +01:00
Michael Osipov 31ad2ff43a Use system line separator wherever possible
This closes #424
2021-01-01 12:55:01 +01:00
Michael Osipov 673a7d1fef Trim trailing whitespace 2020-12-24 19:09:10 +01:00
Sylwester Lachiewicz 449e6dc9db [MNG-6873] update junit dependency to 4.13.1 - also in unit tests 2020-10-27 11:08:56 +01:00
Maarten Mulders df67c00fba [MNG-6991] Restore how the local repository is determined
The refactoring of MavenCli.populateRequest introduced
a subtle bug. It would select ~/.m2/repository as the
local repository instead of something that is configured
in ~/.m2/settings.xml.

Closes #378.
2020-09-29 20:33:25 +02:00
Maarten Mulders ac80f5c2b9 Refactor MavenCli.populateRequest 2020-09-20 11:33:53 +02:00
Martin Kanters 5739b12aa9 Resume from generates misleading hint when multiple projects fail.
Log the topologically sorted first failed project instead of the chronologically first failed project.
Resume from generates misleading hint when multiple projects fail.
Fixed a checkstyle finding.
Removed a trailing space in the -r hint
2020-07-24 10:07:25 +02:00
Maarten Mulders 117cfde44e [MNG-5760] Several fixes for the --resume feature.
BuildResumptionDataRepository is not used in MavenCli

Make setResume() on MavenExecutionRequest a traditional setter

Fix resolution of resume.properties file

Add unit test for DefaultBuildResumptionDataRepository#applyResumptionData

Avoid storing and using an empty excludedProjects field in the resume.properties file.

Avoid star imports

Don't create a unneeded Path when resolving resume.properties

Support the scenario where the first project was failed, but subsequent projects succeeded. (e.g. by fail-at-end or parallel builds)

Maven invocations without project shouldn't fail
2020-07-15 08:58:45 +02:00
rfscholte 658ad90b38 [MNG-5760] Add `-r/--resume` to automatically resume from the last failure point
Author: Martin Kanters <mkanters93@gmail.com>
2020-06-20 13:55:48 +02:00
huangkaifeng 5397fb66e7 [MNG-6873] Align JUnit version to 4.13
Closes #331
2020-05-09 21:19:41 +02:00
Joseph Walton b962ff361a [MNG-5577] Simplify tests to reduce use of wiring.
- Reduce the use of wiring in unit tests
- Enable class scanning for tests that require it.
- Remove test and wiring that's not used.
2020-04-01 19:40:37 +02:00
Michael Osipov 720e46d91d Revert "[MNG-5587] When the build fails emit any errors without the user having to specify -e or -X"
This reverts commit 838c196359.
2020-01-28 10:13:42 +01:00
Sylwester Lachiewicz cdb2cd0df3 [MNG-6071] Normalize relative paths for working directory 2020-01-26 17:25:38 +01:00