Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0-beta-1
-
Fix Version/s: 1.0-beta-2
-
Labels:None
-
Environment:Cygwin, Windows
-
Number of attachments :0
Description
Running publish-scm with a large site can cause the command process to fail due to the command line being too long. For example:
[INFO] --- maven-scm-publish-plugin:1.0-beta-1:publish-scm (scm-publish) @ X --- ... [INFO] Executing: cmd.exe /X /C "git add -- <long list of files>"
Results in:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-scm-publish-plugin:1.0-beta-1:publish-scm (scm-publish) on project X: Failed to add new files to SCM: Exception while executing SCM command. Error while executing command. Error while executing process. Cannot run program "cmd.exe" (in directory X): CreateProcess error=206, The filename or extension is too long -> [Help 1]
Issue Links
- is related to
-
SCM-697
git add fail on windows when a lot of files to add
-
Activity
more a scm issue. or loop on files and add them one by one in the plugin (if windauze is used
)
Thanks for the swift response Olivier! It seems to get past that problem, although I'm now getting a different error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-scm-publish-plugin:1.0-SNAPSHOT:publish-scm (scm-publish) on project X: Failed to add new files to SCM: The parameter is already set: binary -> [Help 1]
I'll have to look into what's happening here and raise another issue, unless you have any ideas?
Only this if it helps:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-scm-publish-plugin:1.0-SNAPSHOT:publish-scm (scm-publish) on project X: Failed to add new files to SCM: The parameter is already set: binary -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-scm-publish-plugin:1.0-SNAPSHOT:publish-scm (scm-publish) on project X: Failed to add new files to SCM
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:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to add new files to SCM
at org.apache.maven.plugins.scmpublish.AbstractScmPublishMojo.addFiles(AbstractScmPublishMojo.java:637)
at org.apache.maven.plugins.scmpublish.ScmPublishPublishScmMojo.scmPublishExecute(ScmPublishPublishScmMojo.java:269)
at org.apache.maven.plugins.scmpublish.AbstractScmPublishMojo.execute(AbstractScmPublishMojo.java:485)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: org.apache.maven.scm.ScmException: The parameter is already set: binary
at org.apache.maven.scm.CommandParameters.setObject(CommandParameters.java:388)
at org.apache.maven.scm.CommandParameters.setString(CommandParameters.java:95)
at org.apache.maven.scm.provider.AbstractScmProvider.add(AbstractScmProvider.java:172)
at org.apache.maven.plugins.scmpublish.AbstractScmPublishMojo.addFiles(AbstractScmPublishMojo.java:623)
... 23 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
That fixed it! I still get a problem after it pushed the site, something to do with staging and aggregate sites, but this is probably a misconfiguration on my part. I'll take a look when I have a chance. Thanks for the quick fix!
Also, the file-by-file add is pretty slow on Windows - the following git status after the add takes the time. It'd be nice if there was a way of writing the long git add command to a file and getting cmd.exe to execute that as input, but not sure if that's possible?
nope I don't similar options ![]()
Have a look at git help add ![]()
git add [-n] [-v] [--force | -f] [--interactive | -i] [--patch | -p]
[--edit | -e] [--all | [--update | -u]] [--intent-to-add | -N]
[--refresh] [--ignore-errors] [--ignore-missing] [--]
[<filepattern>...]
I see that Jenkins gets around this problem by creating a temporary .bat file, e.g.:
cmd /c call C:\Users\Mark\AppData\Local\Temp\hudson4013819556280913972.bat
How about using this idea within Maven SCM?
@Mark I have implemented this workaround.
Can you test that work in windauze ?
Encountered another error using this snapshot when new files are added:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-scm-publish-plugin:1.0-SNAPSHOT:publish-scm (scm-publish) on project X: Failed to add new files to SCM: Exception while executing SCM command. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-scm-publish-plugin:1.0-SNAPSHOT:publish-scm (scm-publish) on project X: Failed to add new files to SCM
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:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to add new files to SCM
at org.apache.maven.plugins.scmpublish.AbstractScmPublishMojo.addFiles(AbstractScmPublishMojo.java:641)
at org.apache.maven.plugins.scmpublish.ScmPublishPublishScmMojo.scmPublishExecute(ScmPublishPublishScmMojo.java:269)
at org.apache.maven.plugins.scmpublish.AbstractScmPublishMojo.execute(AbstractScmPublishMojo.java:485)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
Caused by: org.apache.maven.scm.ScmException: Exception while executing SCM command.
at org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:63)
at org.apache.maven.scm.provider.git.AbstractGitScmProvider.executeCommand(AbstractGitScmProvider.java:291)
at org.apache.maven.scm.provider.git.AbstractGitScmProvider.add(AbstractGitScmProvider.java:187)
at org.apache.maven.scm.provider.AbstractScmProvider.add(AbstractScmProvider.java:174)
at org.apache.maven.plugins.scmpublish.AbstractScmPublishMojo.addFiles(AbstractScmPublishMojo.java:624)
... 23 more
Caused by: java.lang.NullPointerException
at org.apache.maven.scm.provider.git.gitexe.command.GitCommandLineUtils.execute(GitCommandLineUtils.java:135)
at org.apache.maven.scm.provider.git.gitexe.command.add.GitAddCommand.executeAddCommand(GitAddCommand.java:70)
at org.apache.maven.scm.command.add.AbstractAddCommand.executeCommand(AbstractAddCommand.java:46)
at org.apache.maven.scm.command.AbstractCommand.execute(AbstractCommand.java:59)
... 27 more
[ERROR]
[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/MojoExecutionException
Can raise a separate issue in Maven SCM if needs be?
Must be fixed with last SNAPSHOT of maven-scm-provider-gitexe.
Can you try using -U ?
The NPE has gone away but I'm afraid we still have line length problems ![]()
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-scm-publish-plugin:1.0-SNAPSHOT:publish-scm (default-cli) on project X: Failed to add new files to SCM: The git-add command failed. 'C:\Users\mark\AppData\Local\Temp\git-add9095034289317458180bat' is not recognized as an internal or external command,
operable program or batch file.
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:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
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)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to add new files to SCM: The git-add command failed. 'C:\Users\mark\AppData\Local\Temp\git-add9095034289317458180bat' is not recognized as an internal or external command,
operable program or batch file.
at org.apache.maven.plugins.scmpublish.AbstractScmPublishMojo.checkScmResult(AbstractScmPublishMojo.java:634)
at org.apache.maven.plugins.scmpublish.AbstractScmPublishMojo.addFiles(AbstractScmPublishMojo.java:617)
at org.apache.maven.plugins.scmpublish.ScmPublishPublishScmMojo.scmPublishExecute(ScmPublishPublishScmMojo.java:269)
at org.apache.maven.plugins.scmpublish.AbstractScmPublishMojo.execute(AbstractScmPublishMojo.java:485)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 19 more
The temporary file is 30646 characters long. Looks like this exceeds the 8192 limit of cmd.exe:
http://blogs.msdn.com/b/oldnewthing/archive/2003/12/10/56028.aspx
A couple of related points:
- The temporary file is misnamed - the suffix should be ".bat" rather than "bat" in GitAddCommand:126. This resolves the occasional 'unrecognised command' from Windows for some reason.
- The temporary file doesn't need to further call 'cmd.exe' - it can just contain the 'git add ...' command
- These recent changes cause the Maven SCM unit tests to fail under Windows
Looks like we still need to batch the commands in <8192 byte chunks though.
@Mark would you take care of that ? Perso I don't windauze to test
Maybe it will be faster if you hack the windauze hack yourself ?
grhh windauze