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

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 · 9 comments
Assignees
Labels
Milestone

Comments

@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
Copy link
Member

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
Copy link

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
Copy link

@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
- 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
@Spatzier-Beck
Copy link

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
Copy link
Member

@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
Copy link
Member

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.

@Spatzier-Beck
Copy link

@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
Copy link
Member

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

@yinzara
Copy link

yinzara commented May 24, 2022

In case any missed it and were confused, to fix this issue, upgrade protobuf-maven-plugin to 0.6.1 and set the < useArgumentFile>true</useArgumentFile> configuration option in the plugin

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

No branches or pull requests

8 participants
@sannies @yinzara @sergei-ivanov @onderson @fostersanders @Spatzier-Beck and others