CreateProcess error = 206, The filename or extension is too long & quot; solution, filenametoolong

Source: Internet
Author: User
Tags echo message

CreateProcess error = 206, The filename or extension is too long "solution, filenametoolong
In actual projects, I use antrun and closure-compiler to compress JS projects. Then I will use the following code: First add the dependency.

<dependency>    <groupId>com.google.javascript</groupId>    <artifactId>closure-compiler</artifactId>    <version>v20160315</version></dependency>
Add the pom. xml file to the plug-in 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>            <property name="closure.compiler.class.name"                                  value="com.google.javascript.jscomp.CommandLineRunner" />            <echo message="Generate main.min.js" />            <java classname="${closure.compiler.class.name}"                  classpathref="maven.compile.classpath" fork="true" failonerror="true">              <arg value="--js"/>              <arg value="${basedir}/src/main/webapp/js/main.js"/>              <arg value="--js_output_file"/>              <arg value="${basedir}/src/main/webapp/js/main.min.js" />              <arg value="--compilation_level"/>              <arg value="SIMPLE_OPTIMIZATIONS"/>            </java>          </target>        </configuration>      </execution>   </executions> </plugin>

Then an error is reported during running. CreateProcess error = 206, too many errors have occurred» wait) When zookeeper was found and there was a pile of garbled characters behind it. After searching through stackoverflow, it was found that the garbled code was probably "CreateProcess error = 206,The filename or extension is too long"

"There are limits on the length of strings supported by the command line in Windows. on a computer, run Microsoft Windows XP or a later version, the maximum length of a string that can be used in a command prompt is 8191 characters. On a computer running Microsoft Windows 2000 or Windows NT 4.0, the maximum length of a string that can be used at a command prompt is 2047 characters."

I also don't understand why my antrun command is too long and there are so few arg parameters above. Then I use mvn package-X to print the details. Classpathref = "maven. compile. classpath" is found, and all lib jar packages are printed to run the command.

Instead of specifying the jar package closure-complie to run.

Know In maven that you can directly specify the maven dependency's closure-complie.jar package, refer 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>            <property name="closure.compiler.class.name"value="com.google.javascript.jscomp.CommandLineRunner" />              <echo message="Generate main.min.js" />           <path id="maven.lib.dep" path="${com.google.javascript:closure-compiler:jar}"/>             <java classname="${closure.compiler.class.name}"                  classpathref="maven.lib.dep" fork="true" failonerror="true">              <arg value="--js"/>              <arg value="${basedir}/src/main/webapp/js/main.js"/>              <arg value="--js_output_file"/>              <arg value="${basedir}/src/main/webapp/js/main.min.js" />              <arg value="--compilation_level"/>              <arg value="SIMPLE_OPTIMIZATIONS"/>            </java>          </target>        </configuration>      </execution>   </executions> </plugin>

Specify the classpathref Parameter

Related Article

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.