今天用MVN打包的時候遇到下面的錯誤:
Failure executing javac, but could not parse the error:
The command line is too long
在pom文件中jdk的配置為:
<configuration>
<source>${jdk-version}</source>
<target>${jdk-version}</target>
<verbose>false</verbose>
<fork>true</fork>
<executable>${jdk5-home}/bin/javac</executable>
</configuration>
通過查資料,我把<fork>true</fork>注釋掉,就能正常工作了。(把整個<configuration>去掉也行。)
原因是:windows XP及以后的是8191。屏蔽掉<fork>之后,就用maven插件maven-compiler-plugin去編譯java代碼,不用<executable>中的命令行去編譯了。<fork>主要是用于使用和maven插件maven-compiler-plugin不同的jdk版本時。
fork: Allows running the compiler in a separate process. If "false" ituses the built in compiler, while if "true" it will use anexecutable.
當(dāng)javac的命令行較長時,可以指定一個或多個每行含有一個文件名的文件。在命令行中,采用 '@' 字符加上文件名的方法將它指定為文件列表。當(dāng) javac 遇到以 `@' 字符開頭的參數(shù)時,它對那個文件中所含文件名的操作跟對命令行中文件名的操作是一樣的。這使得 Windows 命令行長度不再受限制。
參考網(wǎng)頁: http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請
點擊舉報。