Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maven Daemon doesn't download Core Extensions from pluginRepository defined in settings.xml #1174

Open
matteo-gallo-bb opened this issue Oct 17, 2024 · 1 comment

Comments

@matteo-gallo-bb
Copy link

matteo-gallo-bb commented Oct 17, 2024

On a project that I'm working on, we need to use a patched version of a Maven Extension (specified with .mvn/extensions.xml) that is stored in an internal Maven repository. When using Maven we are able to download the Maven Extension from a pluginRepository specified in the settings.xml (we use --settings option to point to a project specific settings.xml). When using mvnd this doesn't work.
From my investigation it seams that Maven Daemon doesn't resolve the settings.xml passed with --settings option when downloading Maven Core Extensions. In fact it tries to download it from central (https://repo.maven.apache.org/maven2). In our settings.xml we use a mirror of Maven central for both dependencies and plugins. This makes me think that mvnd doesn't use the specified settings.xml at early stage when it needs to resolve Maven Core Extensions defined in .mvn/extensions.xml.

We are using mvnd version 1.0.2.

Partial stacktrace:

java.lang.RuntimeException: Could not initialize org.mvndaemon.mvnd.daemon.Server
	at org.mvndaemon.mvnd.daemon.Server.<init>(Server.java:171)
	at org.mvndaemon.mvnd.daemon.Server.main(Server.java:103)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:292)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:208)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:361)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:314)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:74)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
	at org.mvndaemon.mvnd.daemon.Server.<init>(Server.java:136)
	... 7 more
Caused by: org.apache.maven.cli.internal.ExtensionResolutionException: Extension <omitted> or one of its dependencies could not be resolved: Plugin <omitted> or one of its dependencies could not be resolved:
	Could not find artifact <omitted> in central (https://repo.maven.apache.org/maven2)

	at org.apache.maven.cli.internal.BootstrapCoreExtensionManager.resolveExtension(BootstrapCoreExtensionManager.java:182)
	at org.apache.maven.cli.internal.BootstrapCoreExtensionManager.resolveCoreExtensions(BootstrapCoreExtensionManager.java:115)
	at org.apache.maven.cli.internal.BootstrapCoreExtensionManager.loadCoreExtensions(BootstrapCoreExtensionManager.java:99)
	at org.apache.maven.cli.DaemonMavenCli.loadCoreExtensions(DaemonMavenCli.java:765)
	at org.apache.maven.cli.DaemonMavenCli.container(DaemonMavenCli.java:668)
	at org.apache.maven.cli.DaemonMavenCli.<init>(DaemonMavenCli.java:205)
	at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
	... 10 more
Caused by: org.apache.maven.plugin.PluginResolutionException: Plugin <omitted> or one of its dependencies could not be resolved:
	Could not find artifact <omitted> in central (https://repo.maven.apache.org/maven2)

	at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolveInternal(DefaultPluginDependenciesResolver.java:234)
	at org.apache.maven.plugin.internal.DefaultPluginDependenciesResolver.resolveCoreExtension(DefaultPluginDependenciesResolver.java:159)
	at org.apache.maven.cli.internal.BootstrapCoreExtensionManager.resolveExtension(BootstrapCoreExtensionManager.java:174)
	... 16 more
----- End of the daemon output -----

	at org.mvndaemon.mvnd.client.DaemonConnector.startDaemon(DaemonConnector.java:330)
	at org.mvndaemon.mvnd.client.DaemonConnector.connect(DaemonConnector.java:123)
	at org.mvndaemon.mvnd.client.DefaultClient.execute(DefaultClient.java:353)
	at org.mvndaemon.mvnd.client.DefaultClient.main(DefaultClient.java:171)
	at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
@cstamas
Copy link
Member

cstamas commented Oct 17, 2024

Is there ANY chance to try your build by current master of mvnd (build master of maven then master of mvnd)? I understand it is Maven 4, not Maven 3 as in 1.0.2, but still...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants