Commit Graph

986 Commits

Author SHA1 Message Date
Guillaume Nodet 13ad6376e0
[MNG-8346] Reorganize subprojects (#1837)
Reorganize Maven modules into impl and compat directories
2024-10-25 14:31:46 +02:00
Guillaume Nodet c5a1c53e5c
[MNG-8339] An error during transfer output seems to freeze the output (#1842) 2024-10-24 14:02:04 +02:00
Guillaume Nodet 69c6a3f95b
[MNG-8342] Add command line and terminal information when verbose (#1840) 2024-10-24 13:50:30 +02:00
Guillaume Nodet 35a7b31dc4
[MNG-8310] Use --debug option instead of a specific mvnDebug script (#1812)
Use --debug option instead of a specific mvnDebug script. Deprecate existing mvnDebug script, drop newly added mvnencDebug (as it was not released).
2024-10-18 13:01:21 +02:00
Guillaume Nodet 740100b50c
[MNG-8309] Improve log infrastructure (first step toward multi-threading log view support) (#1792)
Move logging infrastructure to support multi threaded output from mvnd to maven.
Refactor a bit the terminal/log creation done by Cling.
2024-10-15 15:30:39 +02:00
Tamas Cservenak ef9aea6b9c
[MNG-8283] Maven CLIng (#1750)
New CLI for Maven. Goals are reusability, extensibility and easier embeddability (a la mvnd). If you build this branch, you will end up with Maven distro that uses "new" `maven-cli:org.apache.maven.cling.MavenCling` class as entry point instead of "old" `maven-embedder:org.apache.maven.cli.MavenCli`.

First step is to make "pretty much equivalent" capable CLI as compared to "old", with some exceptions:
* "encryption" ops are gone, those should be in separate tool anyway
* "deprecated and unsupported" CLI options like `-llr` present ONLY to make Maven fail are gone (now Arg parser will fail).

Current state of affairs is messy, MavenCli mixes everything it can, contains interleaved logic for bootstrapping, arg parsing, default logic and executing Maven. First goal is to clean this up.

Commons CLI are also hidden in this PR, so is ClassWorlds. This basically opens up way to have "alternative" CLI arguments parsers as well.

Currently the "local" (CLI) flow is this:
```
arg[] -> localParser -> Request -> localInvoker -> maven runs (in situ)
```

But the point is if you "come up" somehow with a Request instance, one can also do just:
```
Request -> invoker -> maven runs (somewhere)
```

Local parser:
* parses CLI args
* infers the defaults
* creates Request object that contains all information needed to run Maven
* can be reused outside of CLI as well
* does NOT fiddle with Plexus, logging, etc.

Local invoker:
* accepts Request object
* deals with configuring env (logging, etc), creating DI container, and running Maven ONLY

There are some experiments ongoing as well, like `ForkedInvoker` is, but also `MavenTool`.

---

https://issues.apache.org/jira/browse/MNG-8283
2024-10-03 18:03:55 +02:00
Guillaume Nodet f6417e4944 [MNG-8281] Interpolator service 2024-10-02 23:26:05 +02:00
Tamas Cservenak 2c6846b09b
No issue, no change (#1745)
Just a simple PR to make properties file a "properties file"
as majority would expect. According to spec '=', ':', or white space
can be delimiter and this file IS valid, but still, users my
be surprised, or tools like IDEs may misinterpret this,
otherwise valid Java Properties File.
2024-09-24 17:34:45 +02:00
Guillaume Nodet deb15be3b6
[MNG-8259] Improve Sisu / DI bridge (#1722) 2024-09-18 13:05:13 +02:00
Guillaume Nodet 36de1c6e51
[MNG-8237] Option deprecation notices cleanup (#1713) 2024-09-12 06:39:22 +02:00
Konrad Windszus 3f430bbd07
[MNG-8228] Enable Sisu Plexus strict classpath scanning (#1688)
This was introduced with
https://github.com/eclipse-sisu/sisu.plexus/issues/51.

This leads to exceptions in case of issues with loading potential
extensions/plexus components instead of logging just with DEBUG level.
2024-08-29 19:42:56 +02:00
Guillaume Nodet 40fe1dc167
[MNG-8220] Fix loading DI-powered beans from extensions (#1683) 2024-08-29 17:32:53 +02:00
Guillaume Nodet 30dc81227b
Renaming of `ArtifactCoordinate.getVersion()` + documentation (#1662)
* Rename ArtifactCoordinate.getVersion() as getVersionConstraint().
* Introduce DownloadedArtifact, DownloadedDependency and ProducedArtifact.
* Rename coordinate -> coordinates.
* Add documentation on Artifact, ArtifactCoordinates, Dependency and DependencyCoordinates and other classes.
* Remove `LATEST` and `SNAPSHOT` from documentation since they are deprecated.
* Opportunistic addition of some missing `@Override` annotations.

---------

Co-authored-by: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
2024-08-27 23:13:34 +02:00
Guillaume Nodet fe3806c41b [MNG-8181] Fix badly placed deprecation 2024-08-26 18:36:22 +02:00
Guillaume Nodet 6ac914d6f9
[MNG-7914] Provide a single entry point for configuration (#1595)
* [MNG-7914] Provide a single entry point for configuration
* [MNG-7914] Rename global -> installation
* [MNG-7914] Include time zone in Maven build timestamp
* [MNG-7914] Use a single place to document all maven properties
2024-08-22 16:47:43 +02:00
Guillaume Nodet 9c1871fd22
Fix StringIndexOutOfBoundsException (#1618) 2024-08-12 23:56:26 +02:00
Slawomir Jaranowski d35864e348 [MNG-8179] Upgrade Parent to 43 2024-07-10 22:52:34 +02:00
Guillaume Nodet fd8f99ed90
Fix Maven 4 extensions (#1601)
* Add rootDirectory to XmlReaderRequest and fix maven-core exported artifacts
* Set the thread context classloader to the container realm to fix class loading from extensions
2024-07-09 14:10:26 +02:00
Elliotte Rusty Harold 910b39cb2a
[MNG-8155] Improve not built error message (#1599)
Part of MNG-8155
2024-07-07 22:42:17 +00:00
Slawomir Jaranowski 768ebbc263
[MNG-7758] Report dependency problems for all repository (#1563) 2024-06-12 09:49:10 +02:00
Pavlo Shevchenko db33754938
[MNG-8150] Remove unused locale argument from FileSizeFormat (#1579)
## Summary

Addressing https://github.com/apache/maven/pull/1575#discussion_r1634977808

 - [x] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)

---

https://issues.apache.org/jira/browse/MNG-8150
2024-06-11 23:48:41 +02:00
Pavlo Shevchenko e995ba62eb
[MNG-8150] Handle absent source/target files in transfer listener (#1575)
The PR address two issues observed in the `SimplexTransferListener` and `ConsoleMavenTransferListener`:
1. [TransferResource#getFile()](https://github.com/apache/maven-resolver/blob/master/maven-resolver-api/src/main/java/org/eclipse/aether/transfer/TransferResource.java#L170) can be null. The current `SimplexTransferListener` will break with an NPE if the `file` is not set on the resource.
2. `TransferResource` is not immutable and does not implement `equals` or `hashCode,` making its usage in collections brittle. Listener consumers are not guaranteed to reuse the same instance across listener invocations. I suggest wrapping it in an immutable identifier.

Resolves https://issues.apache.org/jira/browse/MNG-8150

 - [x] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)

---

https://issues.apache.org/jira/browse/MNG-8150
2024-06-11 22:50:56 +02:00
Guillaume Nodet e9ece0c9c9 Remove commons-io dependency 2024-06-11 11:06:12 +02:00
Martin Desruisseaux 583667a869
[MNG-8015] Adjustments in new API related to PathType (#1501)
* Javadoc cleanup and replacement of some `System.getProperty("...")` by more specific standard methods.

* Add Type.PROCESSOR, MODULAR_PROCESSOR and CLASSPATH_PROCESSOR.

* Modification of the path type API:

* Add a `warningForFilenameBasedAutomodules()` method in `DependencyResolverResult`.
* Add relationships from `JavaPathType` to `javax.tool` location API.
* Modify the `PathType.option(Iterable<? extends Path>)` return type
  because the option and the value need to be two separated arguments.

* Fixes according some comments on the pull request.
2024-05-13 11:53:45 +02:00
Guillaume Nodet 64e9447926
Fix consumer pom builder (#1491) 2024-05-02 17:10:38 +02:00
Jermaine Hua 6814ba386d
Simplified redundant judgment (#1489)
Signed-off-by: crazyhzm <crazyhzm@apache.org>
2024-05-02 14:51:05 +02:00
Guillaume Nodet 3bad5068a2
[MNG-8025] Restore compatibility (#1467) 2024-04-23 15:29:46 +02:00
Guillaume Nodet 52c5659b25
Fix nasty concurrency issue in AbstractSession (#1479)
* Register the session explicitely
* Fix thread interrupted
2024-04-23 14:55:57 +02:00
Guillaume Nodet d075fe7e85 [MNG-8084] New model builder and resolver provider 2024-04-12 12:50:18 +02:00
Guillaume Nodet a6f52774eb Boot JLine in async mode 2024-04-03 19:49:40 +02:00
carrychair 267de063ee
remove repetitive words (#1436)
Signed-off-by: carrychair <linghuchong404@gmail.com>
2024-03-18 00:24:53 +00:00
Guillaume Nodet a9934f91fd
Extract JLine support into its own module (#1426) 2024-02-29 00:31:59 +01:00
Hervé Boutemy 54c1b2f28a [MNG-8029] improve documentation about mirror settings 2024-02-17 19:40:11 +01:00
Guillaume Nodet c88afd470f
Clean mdo schemas (#1365)
* fix namespace location
* remove unneeded CDATA
* code formatting
* use {@code xxx}
* generate location tracking classes
* add location tracking to toolchain model
* Fix javadoc
2024-02-07 22:28:01 +01:00
Tamas Cservenak 6afa4770cb
[MNG-8006] [MNG-8021] SPI to contribute properties and more (#1384)
Create _aether internal_ "extenders" components to serve several purposes:
* extender to meddle with exec request, for example to mediate between effective properties SPI (exec request extender)
* extender to meddle with prepped session and related bits, for example to move out deprecated code from session factory (session extender)

This PR implements M4 API SPI for contributing effective properties and exposes method for effective properties on `Session`.
* `Session` should expose properties service "ready" for interpolation, otherwise each interpolating code (plugin, etc) would need to construct the "effective" ones themselves, repeating same steps over and over again.
* SPI can contribute to user properties
* `Session` exposed properties are all immutable (sans effective, that is computed on each call).
* and lastly, a cleanup: all packages within `o.a.m.internal.aether` are now package protected, to tighten internal encapsulation. New core package `o.a.m.resolver` introduced that contains 2 publicly accessible classes.

---

https://issues.apache.org/jira/browse/MNG-8006
https://issues.apache.org/jira/browse/MNG-8021
2024-01-19 12:00:28 +01:00
Tamas Cservenak 3f47580dcc
[MNG-8005] Fix workspace reader drop bug (#1385)
Maven4 seems sets but then drops/overrides some workspace readers. Partially due hazy borders who or what manages them, as role is split between session factory and session factory caller.

Changes:
* session factory does NOTHING re workspace readers, it becomes fully the caller duty
* two spots calling session factory (default maven, extension bootstrap) are now fully in charge to properly setup workspace readers

Co-authored-by: Jonas Rutishauser <jonas.rutishauser@alumni.ethz.ch>

---

https://issues.apache.org/jira/browse/MNG-8005
2024-01-18 12:51:16 +01:00
Tamas Cservenak 63a207a0f6
[MNG-8007] Maven TransferListener wrapper (#1371)
A wrapper listener that can receive events even from multiple threads, and passes them to wrapped delegate listener on single thread, keeping delegate implementation simple.

---

https://issues.apache.org/jira/browse/MNG-8007
2024-01-11 18:35:13 +01:00
Tamas Cservenak c4ccba7bf9
[MNG-7994] Update to Resolver 2.0.0-alpha-6 (#1373)
Update to alpha-6. Also, move off from deprecated default ctor of def repo session in tests.

---

https://issues.apache.org/jira/browse/MNG-7994
2024-01-11 13:16:51 +01:00
Tamas Cservenak cfa13f5cc7
[MNG-7999] Confine Plexus Container as much as possible (#1367)
This is an ongoing effort to confine Plexus, but also perform a bit of cleanup in Maven Core and around. No logic changes, just replacing Plexus with Lookup (that is a thin wrapper around it), and removing unused members, redundant checks, etc. Module maven-compat omitted on purpose.

---

https://issues.apache.org/jira/browse/MNG-7999
2024-01-10 13:55:54 +01:00
Guillaume Nodet 979fc9a5b6
[MNG-7983] Switch to slf4j-api 2 (#1358) 2024-01-09 07:36:58 +01:00
Guillaume Nodet 782e8679bf
[MNG-7995] Switch to JLine to provide line editing (#1279) 2024-01-08 11:37:09 +01:00
Karl Heinz Marbaise 23d13fb322
[MNG-7989] - Making this build non-interactive, because the environment variable CI equals true. 2023-12-22 19:12:21 +01:00
Tamas Cservenak 732e3649e1
[MNG-7980] CLI switch to ignore transitive repositories. (#1354)
If set, Maven will ignore all remote repositories introduced by
transitive dependencies POM.

---

https://issues.apache.org/jira/browse/MNG-7980
2023-12-20 14:03:57 +01:00
Tamas Cservenak eee9514d3d
[MNG-7963] Clean up the build (#1340)
* [MNG-7963] Clean up the build

Changes:
* remove hamcrest 1.3 from scope
* set proc:none to prevent warnings (Sisu APT is on classpath),
  we do not use annotation processing, we produce Sisu index
  explicitly.
* remove some redundant elements from POMs
2023-12-13 23:19:20 +01:00
Tamas Cservenak c4f62ff7c8
[MNG-7953] Classpath ordering delegated to Resolver (#1332)
Remove all ordering from Maven and delegate it to Resolver.

Supersedes https://github.com/apache/maven/pull/1212

This PR makes Maven completely rely on Resolver to order artifacts on classpath (before this PR it was several spots where explicit ordering was applied without ability to affect it). This PR makes now Maven completely rely on Resolver, never "sort" artifacts on it's own, but use resolver result, that in turn depends on session config.

Example invocation:
```
$ mvn -X package -Daether.system.dependencyVisitor=levelOrder
```

Would make Maven use "levelOrder".

Example of default (preOrder, as before) and new levelOlder (new in 2.0): notice how tree is same, but resulting artifact list (and hence, order on classpath) is different:
https://gist.github.com/cstamas/c88ca550006e53edad5b16973b54c349

The new resolver configuration is documented here:
https://maven.apache.org/resolver-archives/resolver-2.0.0-alpha-3/configuration.html
(property No 62)

---

https://issues.apache.org/jira/browse/MNG-7953
2023-12-07 16:07:51 +01:00
huazhongming 3927ca1843
[MNG-7919] Change the log of unable to find the root directory to info (#1325)
Signed-off-by: crazyhzm <crazyhzm@apache.org>
2023-11-28 00:13:26 +01:00
Tamas Cservenak e89b6fd53f
[MNG-7653] Integrate Resolver 2.x onSessionClose (#1301)
Implement onSessionClose and "resolver 2.x way for sessions"...

As digging happens in same area, some other "resolver configuration" issues resolved as well.

Important: contains a "hack" to fix issue in alpha-2, that is marked with TODO to remove once alpha-3+ used.

---

https://issues.apache.org/jira/browse/MNG-7653
https://issues.apache.org/jira/browse/MNG-7935
https://issues.apache.org/jira/browse/MNG-7936
2023-11-21 12:04:01 +01:00
Karl Heinz Marbaise b08b62f8de
[MNG-7940] - Maven embedder CLI output contains nulls. 2023-11-18 14:15:19 +01:00
sebastien-doyon 94749041b4
[MNG-7899] Various memory usage improvements 4-1 (#1296)
* [MNG-7899] Various memory usage improvements

- BatchModeMavenTransferListener removed
- FileSizeFormat moved to top level class
- FileSizeFormat.formatProcess() refactored to accept an StringBuilder as argument
- FileSizeFormat refactored format() methods
- FileSizeFormat refactored, replace DecimalFormat with Math logic to
reduce memory allocation

---------

Co-authored-by: Guillaume Nodet <gnodet@gmail.com>
2023-11-10 00:47:54 +01:00
sebastien-doyon d362690a82
[MNG-7899] Various memory usage improvements 5 (#1270)
Multiple optimizations :
- renderLevel() method use static constants instead of rebuilding the strings on each call
- replace + operator usage with more PrintStream.print() calls to reduce temporary strings creation
- reduce usage of MessageBuilder.a() method usage with more PrintStream.print() calls to reduce temporary strings creation
- replace the builder() method with a static import
- replace String.format with a simple string concat to reduce memory allocation (garbage)
- change static constants to class member in MavenSimpleLogger
- add a setLength(int) method in MessageBuilder to enable reuse
2023-10-20 16:30:44 +02:00