GWT编译代码具有大量的参数 - 在CreateProcess的字符限制?
-
09-09-2019 - |
题
我试图运行GWT编译Ant构建脚本。该脚本包括大量的库,每一个相对长的路径。我的GWT代码只触及一些库;然而,可以很方便地包括所有从我使用的这个和所有我正在开发其他应用程序的lib目录libaries的。这是我的构建脚本的相关部分:
<path id="gwt.project.class.path">
<pathelement location="gen"/>
<pathelement location="${gwt.sdk}/gwt-user.jar"/>
<fileset dir="${gwt.sdk}" includes="gwt-dev*.jar"/>
<fileset dir="${smartgwt.sdk}" includes="smartgwt*.jar"/>
<!-- Add any additional non-server libs (such as JUnit) -->
<fileset dir="lib" includes="**/*.jar"/>
</path>
<target name="gwtc" depends="compileApp" description="GWT compile to JavaScript" unless="noGWTModule">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="src"/>
<path refid="gwt.project.class.path"/>
</classpath>
<!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
<jvmarg value="-Xmx256M"/>
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg value="${gwt.module}"/>
<arg value="-war" />
<arg value="${gwt.gen.dir}" />
</java>
</target>`
当我尝试运行此,我得到以下错误:
java.io.IOException: CreateProcess: "C:\Program Files\Java\jdk1.5.0_11\jre\bin\java.exe" -Xmx256M -classpath "C:\Program Files\Common Files\eclipse\workspace\development\src;C:\Program Files\Common Files\eclipse\workspace\development\lib\build\hbBuildSupport.jar;C:\Program Files\Common Files\eclipse\workspace\development\lib\db\hibernate\ehcache.jar;C:\Program Files\Common Files\eclipse\workspace\development\lib\db\hibernate\hibernate-annotations.jar;C:\Program Files\Common Files\eclipse\workspace\development\lib\db\hibernate\hibernate-commons-annotations.jar;C:\Program Files\Common Files\eclipse\workspace\development\lib\db\hibernate\hibernate-entitymanager.jar;C:\Program Files\Common Files\eclipse\workspace\development\lib\db\hibernate\hibernate-tools.jar;C:\Program Files\Common Files\eclipse\workspace\development\lib\db\hibernate\hibernate-validator.jar;C:\Program Files\Common Files\eclipse\workspace\development\lib\db\hibernate\hibernate3.jar;C:\Program Files\Common Files\eclipse\workspace\development\lib\db\hibernate\javassi�
似乎在汇编somepoint,包含所有的库的路径的串越来越截断。难道这是由于对CreateProcess的一些字符的限制?这CreateProcess的命令字符串获取要长截断之前,只有大约1024个字符,这似乎是一个小的限制。反正是有提高上限吗?任何想法/溶液/变通理解。
谢谢, MAYUR
解决方案
的问题是,Windows命令行可以存储8191个字符和GWT是放的完整路径中的类路径每个瓶中。解决这个问题的唯一方法是罐子移动到一个目录用更短的路径。
您可以通过一个符号链接,然后引用在生成文件中的链接windows下做到这一点。像这样
从C的根:
mklink /D jars C:\Program Files\Common Files\eclipse\workspace\development\lib
其他提示
有一个很长的类路径中一个可能的解决方法是使用java.ext.dirs
财产,在此目录中删除所有的编译时依赖关系(现在在你的classpath中引用的JAR文件)。
不隶属于 StackOverflow