Commit Graph

267 Commits

Author SHA1 Message Date
Stefan Oehme
b6bddf2ceb Make prompting work in the daemon (#1303)
Some checks failed
Early Access / Default build (without GraalVM) (push) Has been cancelled
Early Access / Build with GraalVM on macos-13 (push) Has been cancelled
Early Access / Build with GraalVM on macos-latest (push) Has been cancelled
Early Access / Build with GraalVM on ubuntu-latest (push) Has been cancelled
Early Access / Build with GraalVM on windows-latest (push) Has been cancelled
Early Access / Site build (push) Has been cancelled
Stale / stale (push) Has been cancelled
The daemon was implementing the legacy plexus.interactivity Prompter interface, which Maven 4 no longer
calls. Instead, it needs to implement the new maven.api Prompter interface. This also simplifies the code,
since the legacy prompter handling is now done by Maven core and it delegates to the new interface if an
old plugin uses it.

Also, prompting was skipped on dumb terminals for some reason. This meant that prompting could not be
tested with automated tests using ProcessBuilder. It also meant that piping input into mvnd on the terminal
wouldn't work. This made it inconsistent with regular Maven, which supports promting on a dumb terminal.
I've reactivated it, which makes the prompting integration tests for our Maven extension pass again.

There was also a missing console flush before sending the response to the daemon, which could lead to
inconsistent output, where the newline was sometimes printed before and sometimes after the next line from
the daemon.

Fixes #1292
2025-09-12 13:04:52 +02:00
Tamas Cservenak
f0a22cb367 Upgrade to Maven 4.0.0-rc-4 (#1347)
Some checks failed
Stale / stale (push) Has been cancelled
Early Access / Default build (without GraalVM) (push) Has been cancelled
Early Access / Build with GraalVM on macos-13 (push) Has been cancelled
Early Access / Build with GraalVM on macos-latest (push) Has been cancelled
Early Access / Build with GraalVM on ubuntu-latest (push) Has been cancelled
Early Access / Build with GraalVM on windows-latest (push) Has been cancelled
Early Access / Site build (push) Has been cancelled
2025-07-19 00:59:54 +02:00
Tamas Cservenak
c4b5656d19 Bug: extension handling (#1282)
mvnd still had mvn3 like code, just drop it and let base parser
do the work. All the mvnd needs is filtering.

Discriminating based on XML file hashes.

Fixes #1280
2025-03-07 19:02:57 +01:00
Guillaume Nodet
eee5c0ca9b Remove build resumption which was ported from master to support resumption with 3.x (#1275) 2025-03-03 08:36:10 +01:00
Tamas Cservenak
0bdeee9dcb [MMG-8600] Adopt to Maven changes (#1277)
Adopt to https://github.com/apache/maven/pull/2134

Goal is to be able to perform required customizations to Terminal, but also "raw streams" (as Maven acts on false, while mvnd on true).
2025-02-28 14:51:59 +01:00
Guillaume Nodet
dac81c7011 Support MAVEN_ARGS env var (fixes #1219) (#1269) 2025-02-17 23:12:32 +01:00
Guillaume Nodet
9e32662401 Refactor input stream support (fixes #1257) (#1268) 2025-02-17 23:12:16 +01:00
Tamas Cservenak
af431d9d54 Move override components back to Sisu (#1263)
As these component are overriding Sisu components.
2025-02-08 21:32:22 +01:00
Tamas Cservenak
d4d4f23d7d Fixes (#1253)
Seems MSC fork does not allow pushes from users who have commit rights on forked maven-mvnd, so am incorporating @ascheman changes here as well.

This PR is:
* fixes from PR https://github.com/apache/maven-mvnd/pull/1252
* plus fix SO isse (self injected cache)
* plus migrated whole daemon to Maven DI (from javax.inject) except those that override Sisu components
* ported latest Maven changes
2025-02-08 20:55:53 +01:00
Tamas Cservenak
7820fcc20c Port mvnsh changes (#1228)
Basically get rid of ResidentContext, is gone.
Also, port some other minor mvn RC-3 changes as well.
2024-12-17 13:54:57 +01:00
Jermaine Hua
7b309de9ab Support core extension more configuration (#1216)
Fixes #1163

Signed-off-by: crazyhzm <crazyhzm@apache.org>
2024-12-17 13:50:43 +01:00
Guillaume Nodet
dade78541c Upgrade to 4.0.0-rc-1 (fixes #1203 and #1204)
# Conflicts:
#	pom.xml
2024-11-26 10:02:05 +01:00
Guillaume Nodet
9f0537a681 Do not display client environment unless specifically asked for 2024-11-26 10:02:05 +01:00
Guillaume Nodet
f191c652f5 Restore ModelCacheFactory 2024-11-08 19:24:50 +01:00
Tamas Cservenak
7726c16bc8 fix: Daemon invoker lifespan must be shared with daemon process lifespan (#1196)
* fix: Daemon lifecycle must be shared with daemon invoker

As long daemon is alive, the daemon invoker must be kept
alive as it holds the "resident" object graph of Maven.

* Add hack

This is a bug in resident invoker
2024-11-08 16:48:53 +01:00
Tamas Cservenak
9734734140 Fix exports and move help in place (#1166)
Depends on https://github.com/apache/maven/pull/1799
Help output https://gist.github.com/cstamas/b53333945eb2d7721e0aa5f03329c4a6
2024-10-17 09:24:29 +02:00
Guillaume Nodet
a032544164 Improve log and leverage the new infrastructure in Maven (#1164) 2024-10-15 18:15:15 +02:00
Tamas Cservenak
27258c0e54 Maven Daemon CLIng (#1158)
Co-authored-by: Guillaume Nodet <gnodet@gmail.com>
2024-10-15 13:05:56 +02:00
Guillaume Nodet
6189475f1b Fix daemon connection race condition (#1078)
The Server was using a SynchrnousQueue to coordinate the main thread
and the background thread that receives the request from the client.
A SynchronousQueue only allows insertions when a corresponding call
to `get` is in progress. However, since the receiver thread is started
before the call to `get`, there was a short time window, where the call
to `queue.offer` could fail and simply return `false`. This return code
was ignored.

A possible solution would have been to call `put` instead of `offer`,
but I decided to replace the queue with a Future, since we only wait
for a single element.

Co-authored-by: Stefan Oehme <st.oehme@gmail.com>
2024-07-19 13:42:11 +02:00
Tamas Cservenak
b6e469089b Maven 4 beta-2 (#998)
And fix the build w/ smaller cleanups, plugin updates and backport of `-itr`, `-sadp`.

Changes:
* Maven 4 beta-2 (staged, on vote)
* Maven Wrapper 3.3.1 + script updates
* maven-plugin-tools 3.13.0
* buildhelper-maven-plugin 3.6.0
* graalvm plugin 0.10.2
* provisio 1.0.25
* exec-maven-plugin 3.3.0
* backport `-itr` and `-sadp` (Maven CLI)
2024-05-22 14:45:33 +02:00
Guillaume Nodet
42b230c10c Upgrade to Maven 4.0.0-beta-1 (#974) 2024-05-03 21:10:04 +02:00
Guillaume Nodet
a6b275db59 Split Maven 3 and 4 support and switch to version 2.0-SNAPSHOT (fixes #973) (#970) 2024-04-26 10:38:39 +02:00
Guillaume Nodet
acf64a7fab Small improvements to DaemonPrompter (#898) 2023-10-25 17:03:24 +02:00
Guillaume Nodet
18d0583304 Fix terminal width (fixes #870) (#891) 2023-10-16 14:40:52 +02:00
Guillaume Nodet
f8adf1b770 Switch to slf4j simple logger (fixes #835) (#868) 2023-07-10 15:16:32 +02:00
Peter Palaga
7d9a39be1a JAVA_HOME should be documented as discriminating #852 2023-05-23 17:30:31 +02:00
Peter Palaga
82e42e6e64 Show which options are discriminating in the output of mvnd --help 2023-05-23 17:30:31 +02:00
Guillaume Nodet
6a3448d9c4 NPE during expiration check (fixes #842) (#843) 2023-05-17 12:57:25 +02:00
Guillaume Nodet
5093ced94b Remove plexus-utils and commons-xxx references (#833) 2023-04-06 10:52:45 +02:00
Guillaume Nodet
eef6c2f16f Sort build times for the whole reactor by decreasing total time (#829) 2023-04-06 10:48:16 +02:00
Guillaume Nodet
0e057cb12b Make sure mvnd's plexus-interactivity is not in the maven classloader, fixes #807
* the logging framework is extracted into its own jar and moved in the mvn/lib/ directory
* the other daemon jars are moved into the mvn/lib/mvnd directory and not used by maven at all
This makes maven class loader almost identical to the stock maven classloader, but for the logging framework
2023-03-14 13:53:24 +01:00
Petr Široký
50653ae7d9 logging: use format specifiers instead of string concatenation 2023-03-12 23:08:32 +01:00
Guillaume Nodet
c2e4ee2f00 Fix EnvHelper#chDir on JDK 21 (#802) 2023-03-10 10:07:17 +01:00
Guillaume Nodet
65da451ecd Switch back to takari smart builder (#805) 2023-03-10 08:48:08 +01:00
Guillaume Nodet
2113d61baa Avoid possible NPE, fixes #795 (#806) 2023-03-10 08:47:33 +01:00
Guillaume Nodet
95b40a3d8a Provide distributions for both maven 3.9.x and 4.0.x (#796) 2023-03-08 00:03:49 +01:00
Petr Široký
1f99fb8cb7 Run client connection handler inside new thread, fixes #798 (#801)
* Run client connection handler inside new thread, fixes #798
* Execute CI build on ubuntu-22.04
 * ubuntu-18.04 image is now deprecated and there are brownout periods
   being introduced where the builds are failing
 * see https://github.com/actions/runner-images/issues/6002 for more
   details
2023-03-07 14:16:04 +01:00
Stefan Oehme
0b55c8f3e6 Add property to disable model caching
This is mostly for the integration tests of the Gradle Enterprise Maven extension,
which heavily test dependency resolution and reuse the same GAVs in many test,
e.g. a:b:1.0. It would be a lot of effort to rewrite all those tests and a shame
to restart the daemon every time. So I wanted to ask if you'd consider this flag
to disable the caching altogether.
2023-03-02 22:42:36 +01:00
Stefan Oehme
1bcfc29d45 Make Classworld setup more alike to vanilla Maven (#784)
Use the plexus Launcher to start the daemon server, just like we would
launch a normal Maven process.

This improves compatibility with any extensions or plugins that assume that
their ClassLoader is a ClassRealm.
2023-02-14 17:06:34 +01:00
Guillaume Nodet
ddc8ef9a10 Remove duplicate header 2023-02-14 16:53:05 +01:00
Guillaume Nodet
9d9f9c62f2 Workaround for MNG-7673 2023-01-28 02:11:14 +01:00
Guillaume Nodet
bf892cd1bf Upgrade to maven 4.0.0-m4 and resolver 1.9.4 2023-01-28 00:07:56 +01:00
Stefan Oehme
74df4b6b53 Fix core export provider (#764)
* Fix core export provider

Since https://github.com/apache/maven/pull/616, the default
CoreExportProvider no longer uses the provided CoreExports,
but instead tries (and fails) to discover them itself.

This change fixes that by providing our own custom instance
of CoreExportProvider. This allows core extension to contribute
exported artifacts and exported packages again, like it used to
do before the Maven 4.x upgrade.

* Add integration tests for API-providing extensions
2023-01-17 11:18:22 +01:00
Guillaume Nodet
f3c336adb9 Fix spotless config to include all java files (#768) 2023-01-10 18:39:29 +01:00
Guillaume Nodet
417ed7ec8b Fix performance problem with mvnd (fixes #758, #760) 2022-12-23 10:22:59 +01:00
Guillaume Nodet
89841adbcb Upgrade to maven parent 39 and reformat accordingly 2022-12-16 11:38:47 +01:00
Guillaume Nodet
55236739f8 Add a mvnd.rawStreams property (#719) 2022-12-16 11:33:59 +01:00
Guillaume Nodet
39ee2b6014 Move signal handling into its own class (#754)
This opens some room to per-jdk implementation
2022-12-16 11:11:04 +01:00
Tamas Cservenak
92cbc7d6cf Update Maven to 4.0.0-alpha-3 and Maven Resolver to 1.9.2 (#742)
https://issues.apache.org/jira/browse/MNG-7586

* Remove CliMavenPluginManager which has the changed needed in alpha-3
* Align slf4j api with maven
* Make sure the invoker being called from IT reuses the settings from the invoker running the IT
* Fix IT when mrm is disabled
* Fix InvalidingPluginRealmCache

Co-authored-by: Guillaume Nodet <gnodet@gmail.com>
2022-12-15 19:26:58 +01:00
James Z.M. Gao
f8d047bdae Use muti-release jar to fallback mvnd-client to original maven (#722)
* Use muti-release jar to fallback mvnd-client to original maven

The mvnd-client is built to a muti-release jar. The default version of
    DefaultClient is compiled against the same target version as the
   embedded maven (4.x, so JDK 1.8) which only invoke the MavenCli.main(). 
The java-11 version is the full qualified mvnd-client.

* update cmd scripts

* embedded maven now works under JDK 1.8

Build SimpleAppender for JDK 1.8 since it is the log appender only
   for the embedded maven

Co-authored-by: Guillaume Nodet <gnodet@gmail.com>
2022-12-14 17:41:02 +01:00