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

Too many .proto lead to "CreateProcess error=206, The filename or extension is too long" on Windows #5

Closed
sannies opened this Issue May 17, 2016 · 8 comments

Comments

5 participants
@sannies
Copy link

sannies commented May 17, 2016

I'm working on a project with 306 proto files. That makes the command line longer than windows allows:

[ERROR] Failed to execute goal org.xolstice.maven.plugins:protobuf-maven-plugin:0.5.0:compile (generate-java-classes-for-generated-protos) on project *******-server: An error occurred while invoking protoc. Error while executing process. Cannot run program "C:\dev\server\******-server\target\protoc-plugins\protoc-2.6.1-windows-x86_64.exe": CreateProcess error=206, The filename or extension is too long -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.xolstice.maven.plugins:protobuf-maven-plugin:0.5.0:compile (generate-java-classes-for-generated-protos) on project *******-server: An error occurred while invoking protoc.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: org.apache.maven.plugin.MojoExecutionException: An error occurred while invoking protoc.
    at org.xolstice.maven.plugin.protobuf.AbstractProtocMojo.execute(AbstractProtocMojo.java:551)
    at org.xolstice.maven.plugin.protobuf.AbstractProtocCompileMojo.execute(AbstractProtocCompileMojo.java:31)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 25 more
Caused by: org.codehaus.plexus.util.cli.CommandLineException: Error while executing process.
    at org.codehaus.plexus.util.cli.Commandline.execute(Commandline.java:675)
    at org.codehaus.plexus.util.cli.CommandLineUtils.executeCommandLineAsCallable(CommandLineUtils.java:134)
    at org.codehaus.plexus.util.cli.CommandLineUtils.executeCommandLine(CommandLineUtils.java:105)
    at org.codehaus.plexus.util.cli.CommandLineUtils.executeCommandLine(CommandLineUtils.java:88)
    at org.xolstice.maven.plugin.protobuf.Protoc.execute(Protoc.java:184)
    at org.xolstice.maven.plugin.protobuf.AbstractProtocMojo.execute(AbstractProtocMojo.java:529)
    ... 28 more
Caused by: java.io.IOException: Cannot run program "C:\dev\server\******-server\target\protoc-plugins\protoc-2.6.1-windows-x86_64.exe": CreateProcess error=206, The filename or extension is too long
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
    at java.lang.Runtime.exec(Runtime.java:620)
    at org.codehaus.plexus.util.cli.Commandline.execute(Commandline.java:655)
    ... 33 more
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:386)
    at java.lang.ProcessImpl.start(ProcessImpl.java:137)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
    ... 35 more
[ERROR] 
[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/MojoExecutionException

I do of course know that this is a Windows restriction but perhaps you can think of a workaround.

@sannies sannies changed the title To many .proto lead to "CreateProcess error=206, The filename or extension is too long" on Windows Too many .proto lead to "CreateProcess error=206, The filename or extension is too long" on Windowos May 17, 2016

@sergei-ivanov sergei-ivanov changed the title Too many .proto lead to "CreateProcess error=206, The filename or extension is too long" on Windowos Too many .proto lead to "CreateProcess error=206, The filename or extension is too long" on Windows May 17, 2016

@sergei-ivanov sergei-ivanov self-assigned this May 17, 2016

@sergei-ivanov sergei-ivanov added this to the 0.6 milestone May 17, 2016

@sergei-ivanov

This comment has been minimized.

Copy link
Member

sergei-ivanov commented May 17, 2016

Hello @sannies,

This has been a constant source of pain and frustration on Windows, and there's no universal workaround at the moment. However, I suspect that passing 306 source proto files on the command line may bust the limits of even more robust operating systems.

You can try voting for protocolbuffers/protobuf#274 -- if they implement it in the same way that javac accepts command line parameters, then life will become so much easier.

I had some ideas of how I could attack it from the maven plugin's perspective, but nothing's planned for the nearest future. I think I'll try to sort it out together with configuration rewrite, because the current implementation does not leave much room for manoeuvre.

If you can split your protos into several smaller groups, then you'll be able to divide and conquer the compilation. You can either split them into several (possibly interdependent) maven modules, or you can split your plugin execution into a number of smaller executions, each compiling a subset of sources (controlled by the include/exclude parameters on each execution).

Kind regards,
Sergei

@fostersanders

This comment has been minimized.

Copy link

fostersanders commented Feb 13, 2017

Hello,

I had the same problem. I didn´t know what to do so I searched on the internet for some solutions.

And I read about [b]Long Path Tool[/b], which is a great tool in these type of cases. :o

It worked really well. Hope it works for you too :p

@onderson

This comment has been minimized.

Copy link

onderson commented Nov 21, 2017

@fostersanders , i wonder how you used Long Path Tool. I have seen couple of people saying the same but have not come across any example. if you could share one. that would be helpful. thanks

sergei-ivanov added a commit to cheister/protobuf-maven-plugin that referenced this issue May 13, 2018

xolstice#5 Integration tests and minor changes
- added an integration test for useArgumentFile option
- fixed writing unicode file names to the argument file
- fixed handling of unicode output from protoc
- simplified path normalisation, tested on both Windows and Linux

sergei-ivanov added a commit to cheister/protobuf-maven-plugin that referenced this issue May 13, 2018

@sergei-ivanov sergei-ivanov added 4 - Done and removed 2 - Working labels May 15, 2018

@Spatzier-Beck

This comment has been minimized.

Copy link

Spatzier-Beck commented Sep 20, 2018

Hello,

is it planned to deploy the new version (0.6.0) to the maven repository (https://mvnrepository.com/artifact/org.xolstice.maven.plugins/protobuf-maven-plugin)?

Why hasn't it been deployed yet? Is there any known issue? It would help us a lot if the version 0.6.0 was available on the maven repository.

Thanks a lot.

Best regards
Rainer

@sergei-ivanov

This comment has been minimized.

Copy link
Member

sergei-ivanov commented Sep 26, 2018

@Spatzier-Beck Sorry for the delay. I wanted to fix some other issues as well and add some documentation, but I hope to release the new version in the next few days.

@sergei-ivanov

This comment has been minimized.

Copy link
Member

sergei-ivanov commented Oct 1, 2018

Release 0.6.1 has just been pushed, but it may take some time until it is fully synced to Maven Central.
When it is available, please give it a go and let me know if it works for you.

@sergei-ivanov sergei-ivanov removed the 4 - Done label Oct 1, 2018

@Spatzier-Beck

This comment has been minimized.

Copy link

Spatzier-Beck commented Oct 2, 2018

@sergei-ivanov Yesterday I integrated the new version 0.6.1 into our build and it works very well. It is not yet visible in the Maven Central Repository Homepage, but it is already available and can be used in maven builds. Thanks a lot for your help :-)

@sergei-ivanov

This comment has been minimized.

Copy link
Member

sergei-ivanov commented Oct 2, 2018

You are very welcome. Looks like Maven Central has been re-indexed and finally the artifacts can be seen on the search page too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment