Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

The filename or extension is too long #1567

Closed
ebremer opened this issue Apr 1, 2022 · 9 comments · Fixed by #1585
Closed

The filename or extension is too long #1567

ebremer opened this issue Apr 1, 2022 · 9 comments · Fixed by #1585
Labels
type: bug A general bug
Milestone

Comments

@ebremer
Copy link

ebremer commented Apr 1, 2022

Using Spring Boot 2.6.4 and Maven 3.8.5, I tried to compile a large project but got the following error:

Failed to execute goal org.springframework.experimental:spring-aot-maven-plugin:0.11.3:generate (default-cli) on project Halcyon: Build failed during Spring AOT code generation: Could not exec java: Cannot run program "C:\bin\graalvm\bin\java.exe" (in directory "D:\projects\lagrproject\target"): CreateProcess error=206, The filename or extension is too long -> [Help 1]

I've gotten this error before without using spring-aot-maven-plugin, but I worked around this by setting the property:
longClasspath=true, but this setting doesn't seem to work when using spring-aot-maven-plugin.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 1, 2022
@mhalbritter
Copy link
Contributor

Looks like a bug with the limited commandline length on windows. Do you know which process starting failed? Can you switch on logging and provide a log file? Thanks!

@mhalbritter mhalbritter added the status: waiting-for-feedback We need additional information before we can continue label Apr 5, 2022
@sdeleuze
Copy link
Contributor

sdeleuze commented Apr 5, 2022

Could be due to graalvm/native-build-tools#212, please try with NBT 0.9.11. Could you share more about longClasspath=true?

@ebremer
Copy link
Author

ebremer commented Apr 6, 2022

This is with NBT 0.9.11. longClasspath=true is a earlier fix for the 206 error used to just build the jar files with maven.

D:\projects\Vega>mvn -Pnative -DskipTests package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< com.ebremer:Vega >-------------------------
[INFO] Building Vega 0.0.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) @ Vega ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1803 resources
[INFO] Copying 96 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ Vega ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 209 source files to D:\projects\Vega\target\classes
[INFO] /D:/projects/Vega/src/main/java/com/ebremer/ethereal/AbstractNodeModel.java: Some input files use or override a deprecated API.
[INFO] /D:/projects/Vega/src/main/java/com/ebremer/ethereal/AbstractNodeModel.java: Recompile with -Xlint:deprecation for details.
[INFO] /D:/projects/Vega/src/main/java/is/Vega/imagebox/experimental/BaseTiffReader.java: D:\projects\Vega\src\main\java\is\Vega\imagebox\experimental\BaseTiffReader.java uses or overrides a deprecated API that is marked for removal.
[INFO] /D:/projects/Vega/src/main/java/is/Vega/imagebox/experimental/BaseTiffReader.java: Recompile with -Xlint:removal for details.
[INFO] /D:/projects/Vega/src/main/java/com/ebremer/ethereal/NodeColumn.java: Some input files use unchecked or unsafe operations.
[INFO] /D:/projects/Vega/src/main/java/com/ebremer/ethereal/NodeColumn.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) @ Vega ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory D:\projects\Vega\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ Vega ---
[INFO] Changes detected - recompiling the module!
[INFO]
[INFO] --- spring-aot-maven-plugin:0.11.3:test-generate (test-generate) @ Vega ---
[INFO] Skip Spring AOT test generation since tests are skipped
[INFO]
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ Vega ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- native-maven-plugin:0.9.11:test (test-native) @ Vega ---
[INFO] Skipping native-image tests (parameter 'skipTests' or 'skipNativeTests' is true).
[INFO]
[INFO] --- spring-aot-maven-plugin:0.11.3:generate (generate) @ Vega ---
[ERROR]
org.apache.maven.plugin.MojoExecutionException: Could not exec java
    at org.springframework.aot.maven.AbstractBootstrapMojo.forkJvm (AbstractBootstrapMojo.java:187)
    at org.springframework.aot.maven.GenerateMojo.execute (GenerateMojo.java:132)
    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)
Caused by: java.io.IOException: Cannot run program "C:\bin\graalvm\bin\java.exe" (in directory "D:\projects\Vega\target"): CreateProcess error=206, The filename or extension is too long
    at java.lang.ProcessBuilder.start (ProcessBuilder.java:1143)
    at java.lang.ProcessBuilder.start (ProcessBuilder.java:1073)
    at org.springframework.boot.loader.tools.RunProcess.run (RunProcess.java:81)
    at org.springframework.aot.maven.AbstractBootstrapMojo.forkJvm (AbstractBootstrapMojo.java:180)
    at org.springframework.aot.maven.GenerateMojo.execute (GenerateMojo.java:132)
    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)
Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is too long
    at java.lang.ProcessImpl.create (Native Method)
    at java.lang.ProcessImpl.<init> (ProcessImpl.java:494)
    at java.lang.ProcessImpl.start (ProcessImpl.java:159)
    at java.lang.ProcessBuilder.start (ProcessBuilder.java:1110)
    at java.lang.ProcessBuilder.start (ProcessBuilder.java:1073)
    at org.springframework.boot.loader.tools.RunProcess.run (RunProcess.java:81)
    at org.springframework.aot.maven.AbstractBootstrapMojo.forkJvm (AbstractBootstrapMojo.java:180)
    at org.springframework.aot.maven.GenerateMojo.execute (GenerateMojo.java:132)
    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)
[ERROR] [org.springframework.aot.maven.AbstractBootstrapMojo.forkJvm(AbstractBootstrapMojo.java:187), org.springframework.aot.maven.GenerateMojo.execute(GenerateMojo.java:132), org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137), org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:301), org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:211), org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:165), org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:157), org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:121), org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81), org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56), org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:127), org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:294), org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192), org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105), org.apache.maven.cli.MavenCli.execute(MavenCli.java:960), org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293), org.apache.maven.cli.MavenCli.main(MavenCli.java:196), java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method), java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77), java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43), java.base/java.lang.reflect.Method.invoke(Method.java:568), org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282), org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225), org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406), org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  6.634 s
[INFO] Finished at: 2022-04-06T11:03:53-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.experimental:spring-aot-maven-plugin:0.11.3:generate (generate) on project Vega: Build failed during Spring AOT code generation: Could not exec java: Cannot run program "C:\bin\graalvm\bin\java.exe" (in directory "D:\projects\Vega\target"): CreateProcess error=206, The filename or extension is too long -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Apr 6, 2022
@mhalbritter
Copy link
Contributor

mhalbritter commented Apr 7, 2022

In org.springframework.aot.maven.AbstractBootstrapMojo#forkJvm we try to start the java process. We supply the classpath with -cp, which could hit the Windows process commandline limit. I guess there's some option to either set this as an ENV variable for the process or supply a file which is then read.

@mhalbritter mhalbritter added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on status: feedback-provided Feedback has been provided labels Apr 7, 2022
@mhalbritter mhalbritter added this to the 0.12.0 milestone Apr 7, 2022
@ebremer
Copy link
Author

ebremer commented Apr 7, 2022

The longClasspath=true option I use traces from here:
https://www.mojohaus.org/exec-maven-plugin/exec-mojo.html

@mhalbritter
Copy link
Contributor

mhalbritter commented Apr 14, 2022

Here's a similiar issue on spring-boot side: spring-projects/spring-boot#17766, with a possible workaround.

@sdeleuze
Copy link
Contributor

cc @bclozel who worked on the plugin in case he could have some context/ideas to share.

@mhalbritter
Copy link
Contributor

I think I have a working solution. Passing the arguments as an argfile, which is supported as of Java 9, seems like a good idea.

@mhalbritter
Copy link
Contributor

See #1585

mhalbritter added a commit to mhalbritter/spring-native that referenced this issue Apr 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug A general bug
Development

Successfully merging a pull request may close this issue.

4 participants