Commit Graph

3246 Commits

Author SHA1 Message Date
Michael Osipov 2d9918a2d1 Clean up dependency warnings by dependency:analyze
This closes #769
2022-07-24 10:44:43 +02:00
Hervé Boutemy 35b93b0a58 [MNG-7353] Add support for "mvn pluginPrefix:version:goal"
This closes #757
2022-07-21 14:38:30 -07: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
Michael Osipov efa9f0c678 [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:26:54 +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
Tamas Cservenak f05397a88d
Pull out lifecycle plugin versions (#766)
To lessen mistake (copy-paste vs forgotten update) but also just to
make things less redundant. This also makes possible "experimenting"
much more easier.

This is merely a refactoring that does not takes or gives anything, just tidies up.
2022-07-12 15:13:55 +02:00
Guillaume Nodet 415eaf31de
[MNG-7160] Ability to customize core extensions classloaders (#616) 2022-06-15 10:43:17 +02:00
Slawomir Jaranowski 54f9d91ebb [MNG-7468] Check unsupported plugins parameters in configuration 2022-06-03 20:54:27 +02:00
Guillaume Nodet 7da0214d1d [MNG-7476] Display a warning when an aggregator mojo is locking other mojos executions
# Conflicts:
#	maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java
2022-05-30 13:29:43 +02:00
Guillaume Nodet 2a276d0dcf [MNG-7487] Fix deadlock during forked lifecycle executions
# Conflicts:
#	maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java

# Conflicts:
#	maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java
2022-05-30 13:15:06 +02:00
Guillaume Nodet 6767f2500f [MNG-7486] Create a multiline message helper for boxed log messages
This closes #746
2022-05-29 13:35:24 +02:00
Tamas Cservenak fc1962e659
[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:54:29 +02:00
Tamas Cservenak a83ed86c48 [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:09:52 +02:00
Guillaume Nodet 1c22f94522 [MNG-7459] Revert "[MNG-7347] SessionScoped beans should be singletons for a given session (#621)"
This reverts commit faf5d5d274.
2022-05-09 10:11:54 +02:00
Slawomir Jaranowski 3dd0afd897 [MNG-7464] Warn about using read-only parameters for Mojo in configuration 2022-05-05 21:12:25 +02:00
Giovanni van der Schelde 93196d4bb7 [MNG-7404] Drop deprecated prefixless expressions
Fixed failing unit tests to use the 'project.' prefix and removed legacy
unit tests that tested support for prefixless expressions.

Closes #696.
2022-04-27 20:12:57 +02:00
Slawomir Jaranowski 702f52d0ea [MNG-7457] Warn about deprecated plugin Mojo 2022-04-24 09:57:10 +02:00
Slawomir Jaranowski 9ac2d08dc7 [MNG-5222] Improvement in deprecated params detection 2022-04-23 09:24:22 +02:00
Tamas Cservenak 551009ab49
[MNG-7454] Include resolver-transport-http in Maven (#720)
Addendum to be2b7f890d98af20eb0753650b6605a68a97ac05:
* fix property name to align with existing ones
* fix logging configuration as no more shaded httpClient
* fix constant names
2022-04-16 18:19:23 +02:00
Hervé Boutemy 643d1e7828 [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:42:02 +02:00
Tamas Cservenak be2b7f890d
[MNG-7454] Include resolver-transport-http in Maven (#711)
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:37 +02:00
Gabriel Belingueres c99028b9fb [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.
2022-04-12 20:49:24 +02:00
Tamas Cservenak bdb35f2deb [MNG-7432] Resolver session contains non-MavenWorkspaceReader
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:46:30 +02:00
Karl Heinz Marbaise 896c707d32
[MNG-7447] - Several Improvements by using Stream API 2022-04-04 20:39:14 +02:00
Jacky d92538b80f
[MNG-7445] - Refactoring, remove the useless line
Contribution by JakcyHu Gakiii

Signed-off-by: Karl Heinz Marbaise <khmarbaise@apache.org>
2022-04-01 22:20:38 +02:00
Guillaume Nodet 31193cbf0c
[MNG-7391] Fix MojosExecutionStrategy lookup to be able to look into the SessionScope (#693) 2022-03-15 06:56:07 +01:00
Guillaume Nodet 97c1e4b4aa
Remove unused test which should have been removed with MNG-7047 (#686) 2022-03-09 13:44:01 +01:00
Guillaume Nodet b3d5c12c7a
[master][MNG-7350] Introduce a factory for ModelCache (#629)
* [MNG-7350] Introduce a factory for ModelCache
* [MNG-7350] Introduce a factory for ModelCache
Fix missing javadoc and binding
2022-03-09 13:29:51 +01:00
Hervé Boutemy 8e5676c84a
[MNG-7391] add execution strategy+runner required by Maven Build Cache (#661)
* [MNG-7391] add execution strategy+runner required by Maven Build Cache
* Fix previous commit
* Fix javadoc
* Fix checkstyle
Co-authored-by: Guillaume Nodet <gnodet@gmail.com>
2022-03-09 11:35:05 +01:00
Maarten Mulders 09e51544df Remove unused import 2022-03-03 10:40:03 +01:00
Michael Osipov 83bbbb3cfb [MNG-6960] Use RuntimeInformation instead of reading properties
This closes #685
2022-02-27 19:27:25 +01:00
Karsten Thoms 5394e750d9 (refactoring) Resolve usage of deprecated method
Replace usage of
  MavenExecutionRequest#getSelectedProjects()
by
  MavenExecutionRequest#getProjectActivation().getOptionalActiveProjectSelectors()

Signed-off-by: Karsten Thoms <karsten.thoms@karakun.com>

This closes #664
2022-02-27 12:58:35 +01:00
Christoph Läubrich e327be3d85 [MNG-7402] BuildListCalculator never detaches the classloader
This closes #683
2022-02-26 21:38:56 +01:00
Sylwester Lachiewicz 69d6c6d5a2 [MNG-7417] Several classes do not set properties properly for building requests
This closes #306
2022-02-20 19:17:47 +01:00
Martin Kanters 03df5f7c63 [MNG-7390] Allow selecting modules outside the cwd into the reactor using --projects
This closes #677
2022-02-19 23:59:40 +01:00
Maarten Mulders 0be5e406d7 [MNG-7406] Do not include formatted details in Exception message
Closes #672
2022-02-16 22:11:52 +01:00
Christoph Läubrich a4729755ae [MNG-7400] Allow more WorkspaceReaders to participate
This closes #667
2022-02-12 21:42:08 +01:00
Guillaume Nodet 1d473233f2 [MNG-6727] Using version range in parent and CI Friendly Version fails 2022-02-01 14:35:07 +01:00
Guillaume Nodet 6b607109d3 [MNG-7349] Limit relocation warning message to direct dependencies only
# Conflicts:
#	maven-resolver-provider/src/main/java/org/apache/maven/repository/internal/DefaultArtifactDescriptorReader.java
2022-01-24 07:57:43 +01:00
Guillaume Nodet 9d4b2b23f0
[MNG-7345] Fix exported packages (#618) 2022-01-18 10:42:47 +01:00
Falko Modler ab4fec0a33 [MNG-7381] Shorten parallel builder thread name to artifactId, conditionally with groupId
This closes #662
2022-01-17 20:39:11 +01:00
Falko Modler 18725ec1e0 [MNG-7380] Don't log non-threadsafe warning if only building a single module
This closes #655
2022-01-11 15:30:52 +01:00
Guillaume Nodet faf5d5d274
[MNG-7347] SessionScoped beans should be singletons for a given session (#621) 2022-01-10 08:19:33 +01:00
Hervé Boutemy c229278477 rework javadoc 2022-01-08 17:27:28 +01:00
Hervé Boutemy f30a0ab4dd [MNG-7267] update artifact handlers documentation 2022-01-08 16:03:57 +01:00
Hervé Boutemy 8bde888dc8 [MNG-7267] update lifecycle documentation after switch from Plexus XML 2022-01-08 15:57:39 +01:00
Hervé Boutemy e617d51bd4 [MNG-7264] packaging plugins bindings cannot be empty 2022-01-08 15:25:54 +01:00
Tamas Cservenak 7180d68a18 Proposal to change abstract provider
Changes:
* validate input
* do not modify loop invariant within loop body
2022-01-08 15:25:54 +01:00
Hervé Boutemy a53083db6c [MNG-7264] refactor packaging bindings providers to ease maintenance 2022-01-08 15:25:54 +01:00
Hervé Boutemy a7375a0eff [MNG-7263] use constants instead of copy/paste 2022-01-08 15:25:13 +01:00
Hervé Boutemy 94af1d99f8 [MNG-7263] improve AbstractLifecycleProvider 2022-01-08 15:25:13 +01:00
Hervé Boutemy 711d5fbbf2 [MNG-7263] introduce AbstractLifecycleProvider 2022-01-08 15:25:13 +01:00
Hervé Boutemy e5b0831c10 [MNG-7263] refactor lifecycle providers to ease documentation
- lifecycle id
- phases
- default plugins bindings
2022-01-08 15:25:13 +01:00
Michael Osipov 2670c00751 [MNG-5561] Plugin relocation loses configuration
Previously, to locate plugin configuration in a project the plugin descriptor
was read first and then the GA were extracted. This always worked because the
GA from the model and the GA from plugin descriptor (plugin.xml) were identical.
When a plugin is relocated the target artifact is read, thus its plugin
descriptor as well. Naturally, the GA of new (relocated) does not correspond to
the old (static) one in the model. Therefore, the configuration is not found.
New approach is to use the original plugin GA to locate the configuration in
the model regardless of the relocation.

This closes #642
2022-01-06 16:54:03 +01:00
Hervé Boutemy d6b9108f58 [MNG-6917] upgrade maven-wrapper-plugin to 3.1.0 2022-01-05 00:09:35 +01:00
Guillaume Nodet 33aedfc28b
[MNG-7156][MNG-7285] Add locking in MojoExecutor (#627) 2021-12-17 09:18:40 +01:00
Guillaume Nodet ae8aebea19
[MNG-7182] Use the MX xpp parser instead of a STAX transformation (#486) 2021-11-29 13:31:55 +01:00
Michael Osipov 8784812cf6 [MNG-7312] Revert ThreadLocal approach from MNG-6843 and MNG-7251
Revert "[MNG-7251] Fix threadLocalArtifactsHolder leaking into cloned project"

This reverts commit a6e462b53a.

Revert "[MNG-6843] Parallel build fails due to missing JAR artifacts in compilePath"

This reverts commit 73e00ed85d.

===

This closes #594
2021-10-22 21:57:09 +02:00
Karl Heinz Marbaise 965aaa53da
[MNG-7314] - Refactoring - Remove unused MavenExecutionResult 2021-10-18 20:47:55 +02:00
Hervé Boutemy f46a9131d5 fix javadoc errors 2021-10-17 12:07:50 +02:00
Arturo Bernal 274388fc0f [MNG-7303] - Replace Throwable.initCause() with constructor. 2021-10-13 22:52:02 +02:00
Giovanni van der Schelde ffc2b99e3e [MNG-6389] Move the toolchains model to a separate artifactId
Closes #586
2021-10-13 16:10:22 +02:00
Arturo Bernal 0080e84588
[MNG-7297] Remove redundant type arguments (#581) 2021-10-11 20:58:38 +02:00
Arturo Bernal 4daa48e0f6 [MNG-7287] Simplify assertion with simpler and equivalent calls
Closes #576
2021-10-10 22:34:07 +02:00
Arturo Bernal b31f3aeef3
[MNG-7291] Avoid String concatenation in loops (#572) 2021-10-10 22:12:41 +02:00
Arturo Bernal 16afe061c9 [MNG-7290] Java8 improvements
Closes #571
2021-10-10 12:50:42 +02:00
Arturo Bernal d61fcf7da1 [MNG-7288] Remove redundant local variables
Closes #569
2021-10-10 12:42:12 +02:00
Arturo Bernal b9fb762215 [MNG-7292] Unnecessarily escaped character
Closes #573
2021-10-10 12:18:15 +02:00
Arturo Bernal 4fafe44112 MNG-7296 - Remove redundant 'if' statement 2021-10-10 10:53:58 +02:00
Arturo Bernal e50d65d228 MNG-7295 - Remove redundant/unused import statements. 2021-10-09 16:26:14 +02:00
Tamas Cservenak 3017b85141
Refactor MavenSession#getPluginContext to be thread safe (#575)
This PR introduce no API change, merely refactors MavenSession
getPluginContext method to truly thread-safe.

Also added Javadoc to affected field and method.
2021-10-09 12:11:36 +02:00
Tamas Cservenak d75bea4154
[MNG-7279] Drop deprecated constructor (#564)
This constructor was deprecated in Maven 3.0-RC1 (!!!).
Removal also means that Maven4 will NOT work with
(Maven2 compatible) m-enforcer-p 2.x, only with
modern m-enforcer-p 3.x line.
2021-10-04 11:56:09 +02:00
Tamas Cservenak 69ee0c8b59
[MNG-7103] VersionScheme provider (#563)
This PR makes VersionScheme a component, is injected where needed
(instead of ad-hoc instantiation), but provides room for
different schemas, as GenericVersionScheme is "default"
but now nothing stops to add other schemes as well.
2021-10-04 11:55:18 +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
Tamas Cservenak af9c64f80d
[MNG-6898] Drop plexus-component-metadata plugin from maven-core (#554)
Now that Plexus XMLs (and components) are out, no need
for this plugin in maven-core module anymore.

Changes:
* convert DefaultLifecyclePluginAnalyzer to JSR330 (last plexus component in core)
* drop dependency on plexus-component-annotations (note: it is still there but only as transitive dep of plexus-shim, needed to boot up Plexus Shim in tests)
* remove plexus-component-metadata plugin from build
* drop unused test Plexus XML
2021-10-02 15:40:58 +02:00
Tamas Cservenak d141957ff5
[MNG-7055] Fix G level metadata handling (#555)
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.
2021-10-02 15:22:32 +02:00
Karl Heinz Marbaise 71a0a49904
[MNG-7272] - Code Improvement - II 2021-10-02 12:39:52 +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
Karl Heinz Marbaise 25cf1576cc
[MNG-7271] - Code Improvement 2021-09-29 22:27:07 +02:00
Guillaume Nodet c8d5ba3705 [MNG-7235] Speed improvements when calculating the sorted project graph
This closes #532
2021-09-27 20:17:08 +02:00
Tamas Cservenak 6c7d105916
[MNG-7264] Convert maven-core default-bindings to Providers (#550)
This change get rids of Plexus components defined in META-INF/plexus/default-bindings.xml and converts them to Providers.
2021-09-26 13:34:27 +02:00
Tamas Cservenak 6c343136b0
Merge pull request #549 from apache/drop-components-xml
[MNG-7263] Convert maven-core components XML to Providers
2021-09-25 12:29:35 +02:00
Tamas Cservenak 2926f033cb [MNG-7265] Convert maven-core artifact-handlers.xml to Providers
Gets rid of another set of Plexus components defined in XML.

Changes:
* DefaultArtifactHandler was declared as component but it is not needed; not
  a component anymore
* Sanitize DefaultArtifactHandler class but retain Plexus XML provisioning
  compatiblity (as plugins does have it declared in Plexus XML) and update its
  uses within Maven code (be explicit)
* Use new "full" constructors in handler providers for easier comparison and
  inspection (be explicit)

This closes #551
2021-09-24 22:09:23 +02:00
Guoxiong Li 5fd536853f [MNG-7248] Fix warnings issued by dependency:analyze
This changeset does intentionally not touch Guice and its dependencies
as well as test-scoped dependencies.

This closes #546
2021-09-24 20:55:03 +02:00
Tamas Cservenak c647dbc665 Get rid of guava 2021-09-23 21:19:50 +02:00
Tamas Cservenak 4cb8909336 Convert maven-core components XML to Providers
This change get's rid of component.xml in maven-core
2021-09-23 11:13:46 +02:00
George Gastaldi a1ba33069f [MNG-7253] Display relocation message defined in model
Move logging to DefaultArtifactDescriptorReader

This closes #543
2021-09-18 20:39:37 +02:00
Guillaume Nodet 23ffe3349f [MNG-7236] The DefaultPluginVersionResolver should cache results for the session 2021-09-14 20:10:13 +02:00
Michael Osipov 6b6589bf1c [MNG-7219] [Regression] plexus-cipher missing from transitive dependencies 2021-09-14 19:21:08 +02:00
Falko Modler a6e462b53a [MNG-7251] Fix threadLocalArtifactsHolder leaking into cloned project
This closes #535
2021-09-14 17:22:42 +02:00
Tamas Cservenak 406c525ec4 [MNG-7250] Upgrade Sisu Inject/Plexus to 0.3.5
Since we have replaced the old JSR 250 library with javax.annotation library we
go straight to 1.3.2 because Maven Resolver 1.7.0 introduced this already as a
transitive dependency in fc806a25eb.
The only difference between version 1.2 and 1.3.2 is a Java upgrade from 6 to 8.

This closes #539
2021-09-13 22:57:31 +02:00
Tamas Cservenak 067171d28a [MNG-7246] Upgrade Plexus Cipher and Sec Dispatcher to 2.0
Both plexus-cipher and plexus-sec-dispatcher have had a
groupId change, but plexus-cipher change was implemented
for 1.8 version.

Latest versions of artifacts are 2.0. This PR
ups plexus-cipher version and adds proper changes
for plexus-sec-dispatcher groupId change.

This closes #534
2021-09-11 10:52:20 +02:00
Mickael Istria f594c0b916 Add ModelSource test for MNG-5669
This closes #525
2021-08-17 10:59:48 +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
rfscholte a2f81065ff [MNG-6656] Features must use userProperties instead of systemProperties 2021-07-23 11:21:18 +02:00
Michael Osipov e9a54c6d02 Use proper term: directory 2021-07-19 23:45:50 +02:00
Michael Osipov 78fc3734f9 Trim trailing whitespace 2021-07-02 18:47:10 +02:00
Michael Osipov b551be7445 Document hacks as such 2021-07-02 17:50:44 +02:00
Falko Modler 73e00ed85d [MNG-6843] Parallel build fails due to missing JAR artifacts in compilePath
Signed-off-by: rfscholte <rfscholte@apache.org>
2021-06-25 19:28:40 +02:00