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

Support wrapper:wrapper 'only-script' distributionType #413

Open
xiaoyao9184 opened this issue Oct 10, 2024 · 0 comments
Open

Support wrapper:wrapper 'only-script' distributionType #413

xiaoyao9184 opened this issue Oct 10, 2024 · 0 comments

Comments

@xiaoyao9184
Copy link

Starting from Wrapper Plugin 3.0 only-script is default distributionType for generate the mvnw/mvnw.cmd script, which no longer uses WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain, and it replaced by org.codehaus.plexus.classworlds.launcher.Launcher.

Version 1.21.0 of this plugin uses org.apache.maven.wrapper.MavenWrapperMain to determine whether it is in wrapper mode, here:

private void initExecutables() {
if (StringUtils.isBlank(cmdMvn.getExecutable())) {
if (StringUtils.isBlank(mvnExecutable)) {
final String javaCommand = mavenSession.getSystemProperties().getProperty("sun.java.command", "");
final boolean wrapper = javaCommand.startsWith("org.apache.maven.wrapper.MavenWrapperMain");

This will cause the automatic usage of the wrapper to fail.

"E:\bin\OpenJDK17U-jdk_x64_windows_hotspot_17.0.9_9\jdk-17.0.9+9\bin\java.exe"
 -classpath
 "C:\Users\xiaoyao9184\.m2\wrapper\dists\apache-maven-3.8.5\b22ce2a0244a1c8678032ad5dfb095c0\boot\plexus-classworlds-2.6.0.jar"
 "-Dclassworlds.conf=C:\Users\xiaoyao9184\.m2\wrapper\dists\apache-maven-3.8.5\b22ce2a0244a1c8678032ad5dfb095c0\bin\m2.conf"
 "-Dmaven.home=C:\Users\xiaoyao9184\.m2\wrapper\dists\apache-maven-3.8.5\b22ce2a0244a1c8678032ad5dfb095c0"
 "-Dlibrary.jansi.path=C:\Users\xiaoyao9184\.m2\wrapper\dists\apache-maven-3.8.5\b22ce2a0244a1c8678032ad5dfb095c0\lib\jansi-native"
 "-Dmaven.multiModuleProjectDirectory=z:\@maven\example-maven-gitflow-plugin"
org.codehaus.plexus.classworlds.launcher.Launcher
 gitflow:feature-start
 -f "z:\@maven\example-maven-gitflow-plugin\pom.xml"
 -Dverbose='true'
 -X
Caused by: org.apache.maven.plugin.MojoFailureException: Failed cmd [mvn] with args [[-DgenerateBackupPoms=false, -DnewVersion=0.0.1-test-SNAPSHOT, org.codehaus.mojo:versions-maven-plugin:2.16.0:set]], bad exit code [1]. Out: ['mvn' is not recognized as an internal or external command, operable program or batch file.]
at com.amashchenko.maven.plugin.gitflow.AbstractGitFlowMojo.executeCommand (AbstractGitFlowMojo.java:1373)
at com.amashchenko.maven.plugin.gitflow.AbstractGitFlowMojo.executeMvnCommand (AbstractGitFlowMojo.java:1318)
at com.amashchenko.maven.plugin.gitflow.AbstractGitFlowMojo.mvnSetVersions (AbstractGitFlowMojo.java:1187)
at com.amashchenko.maven.plugin.gitflow.GitFlowFeatureStartMojo.execute (GitFlowFeatureStartMojo.java:124)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:301)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:211)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:165)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:157)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:121)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:127)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:294)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:960)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
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

1 participant