Commit Graph

3081 Commits

Author SHA1 Message Date
Michael Osipov 88ec1d2383 [MNG-7352] org.apache.maven.toolchain.java.JavaToolchainImpl should be public
This closes #934
2022-12-24 19:57:42 +01:00
Simon a6b8a9e9fb [MNG-7578] Fallback on Linux executable in Windows for findTool utility (#861)
Co-authored-by: Guillaume Nodet <gnodet@gmail.com>
2022-12-18 17:17:34 +01:00
Michael Osipov 46c84876d7 Directories, not folders 2022-12-18 16:37:08 +01:00
Michael Osipov a1d43778ef [MNG-7636] Partially revert MNG-5868 to restore backward compatibility (see MNG-7316)
Co-authored-by: Gary Gregory <ggregory@rocketsoftware.com>

This closes #919
2022-12-18 13:27:16 +01:00
Christoph Läubrich 4db9b94baf [MNG-7637] Possible NPE in MavenProject#hashCode()
This closes #921
2022-12-18 12:13:07 +01:00
Tamas Cservenak 69c5a5dbdb
[MNG-7619] Reverse Dependency Tree (#900)
Adds Maven feature that is able to explain why an artifact is present in local repository.

Usable for diagnosing resolution issues.

In local repository, for each artifact it records `.tracking` folder, containing farthest artifact that got to this artifact, and the list of graph nodes that lead to it.

Note: this is based on by @grgrzybek proposal and reuses some code he provided. See https://github.com/apache/maven-resolver/pull/182

---

https://issues.apache.org/jira/browse/MNG-7619
2022-12-05 16:19:20 +01:00
Tamas Cservenak 2dc7a356d3 [MNG-7612] Chained LRM
Adds new feature: Chained Local Repository Manager.

---

https://issues.apache.org/jira/browse/MNG-7612
2022-12-02 17:57:47 +01:00
Tamas Cservenak 573a3e1ec5
[MNG-7614] Translate Plexus XML to proper resolver configuration (#895)
Now that Maven 3.9.x contains other transports than Wagon, the Plexus XML is not just to be "stuffed", but translation should happen to proper resolver configuration to make them available to all transports.

---

https://issues.apache.org/jira/browse/MNG-7614
2022-12-02 16:12:01 +01:00
Slawomir Jaranowski 693814f0a5 [MNG-7613] Parent POM 38 - code reformat 2022-12-02 12:54:12 +01:00
Tamas Cservenak c3919cdd0e
[MNG-7586] Update Maven Resolver to 1.9.2 (#881)
* [MNG-7586] Update Maven Resolver to 1.9.2

Updates resolver to latest release.

---

https://issues.apache.org/jira/browse/MNG-7586
2022-11-26 20:08:09 +01:00
Slawomir Jaranowski 474a470aa9 [MNG-7600] LocalRepositoryManager is created too early
LocalRepositoryManager needs configurations from RepositorySystemSession
so must be created after session configuration is finished.

(cherry picked from commit b1c1f7556d)
2022-11-22 00:01:05 +01:00
Tamas Cservenak b8b41c6d40 Revert "[3.9.x][MNG-7586] Update Maven Resolver to 1.9.1 (#831)"
This reverts commit 2d384ddce3.
2022-11-18 10:28:09 +01:00
Tamas Cservenak 2d384ddce3
[3.9.x][MNG-7586] Update Maven Resolver to 1.9.1 (#831)
Update to Maven Resolver 1.9.1 and apply required changed changes in Maven.

Changes:
- hook in lifecycle

---

https://issues.apache.org/jira/browse/MNG-7586
2022-11-17 16:21:41 +01:00
Slawomir Jaranowski fa2febb6f3 [MNG-7590] Allow to configure resolver by properties in settings.xml
Cherry-pick from fa15fcf153
2022-11-12 12:36:39 +01:00
Piotrek Żygieło 8a5dada82c [MNG-7568] Consider inactive profiles for validation 2022-11-05 10:30:11 +01:00
Abdel Hajou 3212efee78 [MNG-7564] Check if session is null when generating metadata
Backported (and adapted) from master.
2022-10-31 10:20:08 +01:00
Michael Osipov 0f4387543d [MNG-7556] Clean up notion between user properties and system properties 2022-10-29 20:19:49 +02:00
Tamas Cservenak 5136a5ea81
Maven-3.9.x Simplify maven-plugin metadata handling (#807) 2022-10-11 14:11:34 +02:00
Sylwester Lachiewicz 2f7dfcfe82 [MNG-7502] Upgrade to Guice 5.1.0
(cherry picked from commit 5502c0c8db)
2022-09-11 10:00:07 +02:00
Guillaume Nodet b762fa9d5c
[3.9.x] [MNG-7401] [MNG-7474] Keep a single maven session and fix session scope (#743)
* [MNG-7474] SessionScoped beans should be singletons for a given session

Now that the Session is not cloned anymore, we can revert to the original
(Maven < 3.3) behavior of the session scoped components.

Co-authored-by: Christoph Läubrich <christoph@laeubi-soft.de>

This closes #743

* Remove setting a value which is the default already

Co-authored-by: Christoph Läubrich <christoph@laeubi-soft.de>
2022-08-23 11:19:11 +02:00
Hervé Boutemy 95bdbf6821 [MNG-7353] Add support for "mvn pluginPrefix:version:goal"
This closes #757
2022-07-21 14:37:34 -07:00
Josef Cacek e1e4f5bda0 [MNG-7511] Ensure the degreeOfConcurrency is a positive number in MavenExecutionRequest
This closes #767
2022-07-18 22:35:28 +02:00
Michael Osipov f164ab5f89 [MNG-7513] Address commons-io_commons-io vulnerability found in maven latest version
We can safely remove Commons IO altogether because it is not used in any direct or
transitive usecase at compile time or runtime.

This closes #771
2022-07-18 17:31:06 +02:00
Sylwester Lachiewicz e4f347ed85 [MNG-6965] Extensions suddenly have org.codehaus.plexus:plexus-utils:jar:1.1 on their classpath
This closes #367
2022-06-24 19:10:33 +02:00
Slawomir Jaranowski b3e7e57e4b [MNG-7504] Don't print warning unsupported reportPlugins for m-site-p 2022-06-20 23:59:02 +02:00
Guillaume Nodet 115febf29b [MNG-7160] Ability to customize core extensions classloaders (#616) 2022-06-18 12:30:40 +02:00
Slawomir Jaranowski 0504c361b4 [MNG-7468] Check unsupported plugins parameters in configuration - 3.9
(cherry picked from commit 54f9d91ebb)
2022-06-06 17:23:15 +02:00
Guillaume Nodet 0a94ff769c [MNG-7476] Display a warning when an aggregator mojo is locking other mojos executions 2022-05-30 13:10:42 +02:00
Guillaume Nodet 0b0a96782e [MNG-7487] Fix deadlock during forked lifecycle executions
# Conflicts:
#	maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java
2022-05-30 13:10:25 +02:00
Guillaume Nodet aec341a7a9 [MNG-7486] Create a multiline message helper for boxed log messages
This closes #746
2022-05-29 13:34:53 +02:00
Tamas Cservenak 70e9381a74 [MNG-7478] Transport selection should use config properties (#739)
Instead of user properties, as this allows making "permanent" the
selection by using MAVEN_OPTS and other places as well. Currently
only via command line works.

Also, do not modify existing Maven behavior, so introduce "default" branch
in selection. See comment in code
2022-05-17 08:58:21 +02:00
Tamas Cservenak 4de39476ff [MNG-7471] Make Resolver util and connector-basic provided (#732)
Problem: resolver spi, impl and connector-basic has changes in 1.8.0 (SPI interface RepositoryLayout got new method, that is implemented in connector-basic, and code from impl is using it). But, Maven core exports only resolver api, spi and impl packages, while the rest is at mercy of a plugin. This means ,that these artifacts (api, spi and impl) will always come from Maven core, whatever version plugin declares, while the "rest" (connector-basic and util) will be of version that plugin declares. The current state hence prevented ANY KIND of changes on SPI interfaces that would be implemented in connector-basic (which is the case in Resolver 1.8.0).

Solution: make all these resolver artifacts "provided" (to behave like maven-core or maven-plugin-api is behaving): simply put, whatever resolver artifact plugin depends on, it should NOT use it's own version, but the version from Maven. This ensures that api-spi-impl-connector-basic as "aligned" and are same version.

Details:

The change is to make util is exportedArtifact AND exportedPackage, while connector-basic is only exportedArtifact.

Reasoning:
* exportedArtifact -- prevents "own" artifact to be added to realm
* exportedPackage -- makes it "visible" in realm

So, this basically prevents bad versions of util and connector-basic
enter the plugin realm (as they will be not added to it), while
util remains "visible" to plugins, as the intent was, most
common due GenericVersions etc.

This change also results in simpler expectations to plugin developers:
resolver libraries should really behave like maven-core or maven-compat:
when plugin declares dependency on these (w/ scope provided as best
practice), they really get version of these that are of version that
maven runs in, not version they declare. So same thing happens now with
resolver: you will get same version of resolver that maven uses your plugin
runs in.

Before this change, it was a mixed bag: api, spi and impl was from maven,
while util and connector-basic was version you pulled in as dep.
2022-05-11 16:06:37 +02:00
Guillaume Nodet 89237dd74d Revert "[MNG-7347] SessionScoped beans should be singletons for a given session (#653)" (#715)
This reverts commit b4518b5fe4.
2022-05-09 10:04:54 +02:00
Slawomir Jaranowski 74eba2968b [MNG-7464] Warn about using read-only parameters for Mojo in configuration
(cherry picked from commit 3dd0afd897)
2022-05-06 23:05:12 +02:00
Slawomir Jaranowski dd0ddef8f6 [MNG-7457] Warn about deprecated plugin Mojo
(cherry picked from commit 702f52d0ea)
2022-04-24 13:49:26 +02:00
Slawomir Jaranowski 28c763c72c [MNG-5222] Improvement in deprecated params detection
This is backport of commit 9ac2d08dc7 from master to maven-3.9.x branch.
2022-04-23 12:29:41 +02:00
Tamas Cservenak 4c9dc5abb2
[MNG-7055] Fix G level metadata handling in 3.9.x (#691)
Maven Artifact Transfer silently prevents group level metadata to reach Resolver and causes metadata loss on install/deploy.
Fix is to "bridge" this from maven-resolver-provider (and core) by reusing the actual metadata that
m-plugin-p:addPluginArtifactMetadata mojo adds, but m-a-t filters out.

This is backport of commit d141957ff5 from master to maven-3.9.x branch.
2022-04-22 17:51:07 +02:00
Tamas Cservenak 85caf98029 [MNG-7454] Include resolver-transport-http in Maven (#720)
Addendum to 1ad5a1b1e9bb0a17fc12bbe0314564a616078602:
* fix property name to align with existing ones
* fix logging configuration as no more shaded httpClient
* fix constant names
2022-04-16 18:21:48 +02:00
Hervé Boutemy 3c6009cbf4 [MNG-7438] add execution id to "configuring mojo" debug message
[DEBUG] Configuring mojo execution
'org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test:default-test'
with basic configurator

rephrase "Configuring" to "Loading" mojo "from plugin realm"
to differentiate from "configuring mojo" = apply configuration

rename populatePluginFields(..) private method
to populateMojoExecutionFields(..) to better match the intent
2022-04-15 18:40:52 +02:00
Tamas Cservenak 1ad5a1b1e9
[MNG-7454] Include resolver-transport-http in Maven 3.9.x (#710)
But keep Wagon as default transport. This PR merely includes
resolver http and file transport and switches wagon-http
to non-shaded one.

Changes:
* switch to non-shaded wagon-http (as httpClient is now shared)
* include resolver http and file transport
* override resolver default behaviour (native transport preferred over wagon, when both on classpath)
* provide simplistic means to choose transport

The chosen transport can be seen in debug (-X) output on line
`[DEBUG] Using transporter XXX...`

The `-Dmaven.transport` simplistic switch can be used to choose transport:
* not set: default, that is Wagon
* `wagon`: explicitly sets Wagon
* `resolver`: explicitly sets resolver native transports (file and http)
* `auto`: relies on resolver "auto discovery" (priorities, etc). This is MUST to keep transport pluggable with 3rd party transports. In fact, this was the default so far in Maven, along with the fact that native resolver transports were not included (as resolver prefers native ones over Wagon).
2022-04-13 12:51:19 +02:00
Gabriel Belingueres ff0300b7cf
[MNG-5222] Maven 3 no longer logs warnings about deprecated plugin parameters
- Added warning when setting deprecated parameter with value different
than the default.
- Changed Logger to SLF4J.

(cherry picked from commit c99028b9fb)
2022-04-12 22:49:03 +02:00
Tamas Cservenak 08dff22a41
[MNG-7447] Fix ReactorReader unintended change (#709)
The commit c604db3c3a
changed ReactorReader to use MavenSession#getAllProjects()
instead of deprecated MavenSession#getProjectMap() that
is equivalent of MavenSession#getProjects().

This undoes this unintended change.
2022-04-08 18:24:03 +02:00
Tamas Cservenak 263cf9542b [MNG-7432] Resolver session contains non-MavenWorkspaceReader (#695)
As Resolver session contains non-MavenWorkspaceReader, the reactor models (already resolved w/ profiles applied) are re-built when using Resolver within Mojo, instead to get them via ReactorReader as expected. The rebuilt models will lack explicit (-P on CLI) profiles applied, as resolver itself is not maven aware, hence there is no way to "tell" resolver to apply them. Building reactor models w/ profiles applied is NOT done using resolver, but by Maven when loading up reactor, as profiles are NOT applied for downstream transitive dependencies (see discussion on MNG-1388 why).

Signed-off-by: Christoph Läubrich <christoph@laeubi-soft.de>
Co-authored-by: Christoph Läubrich <christoph@laeubi-soft.de>
Co-authored-by: Tamas Cservenak <tamas@cservenak.net>
2022-04-08 10:32:15 +02:00
Karl Heinz Marbaise c604db3c3a
[MNG-7447] - Several Improvements by using Stream API 2022-04-05 21:24:58 +02:00
Jacky f7b073f3eb
[MNG-7445] - Refactoring, remove the useless line
Contribution by JakcyHu Gakiii

Signed-off-by: Karl Heinz Marbaise <khmarbaise@apache.org>
2022-04-01 22:21:36 +02:00
Guillaume Nodet 3a5a40c6d2
[MNG-7391] Fix MojosExecutionStrategy lookup to be able to look into the SessionScope (#692) 2022-03-15 06:55:50 +01:00
Guillaume Nodet 14ca723438 [MNG-7350] Introduce a factory for ModelCache 2022-03-09 13:33:45 +01:00
Guillaume Nodet 1954d51ff2 [MNG-7391] add execution strategy+runner required by Maven Build Cache 2022-03-09 10:33:40 +01:00
mickroll a55300a588 [MNG-6972] Allow access to org.apache.maven.graph
This is, for example, needed for rebuilding the dependency graph during build
extension execution after changing dependencies.

This closes #368
2022-03-06 21:12:47 +01:00
Michael Osipov 6b7beb4db8 [MNG-7019] Notify also at start when profile is missing 2022-03-06 21:12:47 +01:00