CreateProcess error=206, the filename or extension is a too long "solution

Source: Internet
Author: User

In the actual project I used Antrun and closure-compiler to compress the JS project. Then I use the following code: first join the dependency.
<Dependency>    <groupId>Com.google.javascript</groupId>    <Artifactid>Closure-compiler</Artifactid>    <version>v20160315</version></Dependency>
Add the plugin code to the Pom.xml file.
<plugin>    <groupId>Org.apache.maven.plugins</groupId>    <Artifactid>Maven-antrun-plugin</Artifactid>    <version>1.6</version>    <executions>      <Execution>    <Phase>Generate-sources</Phase>        <Goals>          <goal>Run</goal>        </Goals>        <Configuration>          <Target>            < Propertyname= "Closure.compiler.class.name"value= "Com.google.javascript.jscomp.CommandLineRunner" />            <Echomessage= "Generate main.min.js" />            <JavaClassName= "${closure.compiler.class.name}"Classpathref= "Maven.compile.classpath"Fork= "true"FailOnError= "true">              <Argvalue= "--js"/>              <Argvalue= "${basedir}/src/main/webapp/js/main.js"/>              <Argvalue= "--js_output_file"/>              <Argvalue= "${basedir}/src/main/webapp/js/main.min.js" />              <Argvalue= "--compilation_level"/>              <Argvalue= "Simple_optimizations"/>            </Java>          </Target>        </Configuration>      </Execution>   </executions> </plugin>

Then run to find an error. CreateProcess error=206,?? T??? Ò)??? Then there is a pile of garbled characters, and then after StackOverflow find after found garbled is probably "CreateProcess error=206, the filename or extension is too long"

" under Windows, the string length supported by the command line is limited, and the maximum length of a string that can be used at the command prompt is 8,191 characters on a computer that is running Microsoft Windows XP or later. On a computer that is running Microsoft Windows 2000 or Windows NT 4.0, the maximum length of the string that can be used at the command prompt is 2047 characters. "

I can't figure out why my antrun command is too long and there are so few arg parameters on it. Then I use MVN package–x to print the details. Found a classpathref= "Maven.compile.classpath" back to print all Lib jar packages to run the command.

Instead of specifying Closure-complie to run this jar package.

In Maven, you know that you can specify the Closure-complie.jar package that Maven relies on directly, referring to the following address:

Http://maven.apache.org/plugins/maven-antrun-plugin/examples/classpaths.html

So modify the above Pom.xml code:

<plugin>    <groupId>Org.apache.maven.plugins</groupId>    <Artifactid>Maven-antrun-plugin</Artifactid>    <version>1.6</version>    <executions>      <Execution>    <Phase>Generate-sources</Phase>        <Goals>          <goal>Run</goal>        </Goals>        <Configuration>          <Target>            < Propertyname= "Closure.compiler.class.name"value= "Com.google.javascript.jscomp.CommandLineRunner" />              <Echomessage= "Generate main.min.js" />           <PathID= "MAVEN.LIB.DEP"Path= "${com.google.javascript:closure-compiler:jar}"/>             <JavaClassName= "${closure.compiler.class.name}"Classpathref= "MAVEN.LIB.DEP"Fork= "true"FailOnError= "true">              <Argvalue= "--js"/>              <Argvalue= "${basedir}/src/main/webapp/js/main.js"/>              <Argvalue= "--js_output_file"/>              <Argvalue= "${basedir}/src/main/webapp/js/main.min.js" />              <Argvalue= "--compilation_level"/>              <Argvalue= "Simple_optimizations"/>            </Java>          </Target>        </Configuration>      </Execution>   </executions> </plugin>

Specifying the CLASSPATHREF parameter

CreateProcess error=206, the filename or extension is a too long "solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.