Createprocess error = 206;文件名或扩展名太长[重复]

时间:2021-11-28 17:17:40

This question already has an answer here:

这个问题在这里已有答案:

I know this question has been asked before, but I wasn't able to fix it using solutions from other posts. I'm trying to compile a complex hierarchy of gwt projects using maven. Everything worked fine until I had to add one more library, more specifically: org.eclipse.birt.runtime

我知道之前已经问过这个问题,但我无法使用其他帖子的解决方案来修复它。我正在尝试使用maven编译复杂的gwt项目层次结构。一切正常,直到我不得不再添加一个库,更具体地说:org.eclipse.birt.runtime

Now I get this error:

现在我收到此错误:

[ERROR] Failed to execute goal org.codehaus.mojo:gwt-maven-plugin:2.6.1:debug ....

..... [Lots of jars, many containing birt, no duplicates though] .....


Error while executing process. Cannot run program "C:\Program Files\Java\jdk1.8.0_20\jre\bin\java": CreateProcess error=206, The filename or extension is too long

The dependency I'm using is:

我正在使用的依赖是:

<dependency>
    <groupId>org.eclipse.birt.runtime</groupId>
    <artifactId>org.eclipse.birt.runtime</artifactId>
    <version>4.4.1</version>
</dependency>

2 个解决方案

#1


6  

I finally managed to solve it:

我终于设法解决了它:

Turns out birt, together with its dependencies, was simply adding too many libraries and the classpath became too long for windows command to handle. Furthermore, birt libraries have stupidly long names.

结果是birt,连同它的依赖,只是添加了太多的库,类路径变得太长,Windows命令无法处理。此外,birt图书馆的名字很长。

Solved it using this dependency (I only needed the runtime), I created the lib and birt directories and placed the jar there myself:

解决了它使用这种依赖(我只需要运行时),我创建了lib和birt目录并将jar放在那里:

<dependency>
    <groupId>org.eclipse.birt.runtime</groupId>
    <artifactId>org.eclipse.birt.runtime</artifactId>
    <version>4.4.1</version>
    <scope>system</scope>
    <systemPath>${basedir}/lib/birt/birt.runtime-4.4.1.jar</systemPath>
</dependency>

#2


0  

Birt has no reason to be in the classpath if it's not used client-side.

如果没有使用客户端,Birt没有理由进入类路径。

Unfortunately, Maven sometimes makes things harder than necessary; so with Maven you need your GWT client code to be a specific Maven module with no dependency on server-side code; then "merge" everything into a single WAR using WAR overlays.

不幸的是,Maven有时会让事情变得更加艰难;因此,对于Maven,您需要将GWT客户端代码作为特定的Maven模块,而不依赖于服务器端代码;然后使用WAR覆盖将所有内容“合并”到一个WAR中。

With that layout (let's call the modules app-client and app-server), you have several solutions to launch gwt:run or gwt:debug:

使用该布局(让我们调用模块app-client和app-server),你有几个解决方案来启动gwt:run或gwt:debug:

  • never tried but you could probably configure hostedWebapp to point to your app-server output directory:

    从未尝试过,但您可以将hostedWebapp配置为指向您的app-server输出目录:

    <hostedWebapp>../app-server/target/app-server-${project.version}/</hostedWebapp>
    

    Make sure you run mvn clean before packaging your app-server WAR though to be sure the generated JS files come from app-client (as a WAR overlay) and not app-server (generated by gwt:run)

    确保在打包app-server WAR之前运行mvn clean,以确保生成的JS文件来自app-client(作为WAR覆盖)而不是app-server(由gwt:run生成)

  • what I use in gwt-maven-archetypes: launch the server-side code in a distinct servlet container, and use <noServer>true</noServer>

    我在gwt-maven-archetypes中使用的:在不同的servlet容器中启动服务器端代码,并使用 true

    Make sure you run mvn clean before packaging too, or use -Dgwt.compiler.force, to be sure gwt:compile won't treat the DevMode-generated *.nocache.js file as up-to-date and will recompile the application.

    确保在打包之前运行mvn clean,或者使用-Dgwt.compiler.force,以确保gwt:compile不会将DevMode生成的* .nocache.js文件视为最新文件,并将重新编译应用程序。

#1


6  

I finally managed to solve it:

我终于设法解决了它:

Turns out birt, together with its dependencies, was simply adding too many libraries and the classpath became too long for windows command to handle. Furthermore, birt libraries have stupidly long names.

结果是birt,连同它的依赖,只是添加了太多的库,类路径变得太长,Windows命令无法处理。此外,birt图书馆的名字很长。

Solved it using this dependency (I only needed the runtime), I created the lib and birt directories and placed the jar there myself:

解决了它使用这种依赖(我只需要运行时),我创建了lib和birt目录并将jar放在那里:

<dependency>
    <groupId>org.eclipse.birt.runtime</groupId>
    <artifactId>org.eclipse.birt.runtime</artifactId>
    <version>4.4.1</version>
    <scope>system</scope>
    <systemPath>${basedir}/lib/birt/birt.runtime-4.4.1.jar</systemPath>
</dependency>

#2


0  

Birt has no reason to be in the classpath if it's not used client-side.

如果没有使用客户端,Birt没有理由进入类路径。

Unfortunately, Maven sometimes makes things harder than necessary; so with Maven you need your GWT client code to be a specific Maven module with no dependency on server-side code; then "merge" everything into a single WAR using WAR overlays.

不幸的是,Maven有时会让事情变得更加艰难;因此,对于Maven,您需要将GWT客户端代码作为特定的Maven模块,而不依赖于服务器端代码;然后使用WAR覆盖将所有内容“合并”到一个WAR中。

With that layout (let's call the modules app-client and app-server), you have several solutions to launch gwt:run or gwt:debug:

使用该布局(让我们调用模块app-client和app-server),你有几个解决方案来启动gwt:run或gwt:debug:

  • never tried but you could probably configure hostedWebapp to point to your app-server output directory:

    从未尝试过,但您可以将hostedWebapp配置为指向您的app-server输出目录:

    <hostedWebapp>../app-server/target/app-server-${project.version}/</hostedWebapp>
    

    Make sure you run mvn clean before packaging your app-server WAR though to be sure the generated JS files come from app-client (as a WAR overlay) and not app-server (generated by gwt:run)

    确保在打包app-server WAR之前运行mvn clean,以确保生成的JS文件来自app-client(作为WAR覆盖)而不是app-server(由gwt:run生成)

  • what I use in gwt-maven-archetypes: launch the server-side code in a distinct servlet container, and use <noServer>true</noServer>

    我在gwt-maven-archetypes中使用的:在不同的servlet容器中启动服务器端代码,并使用 true

    Make sure you run mvn clean before packaging too, or use -Dgwt.compiler.force, to be sure gwt:compile won't treat the DevMode-generated *.nocache.js file as up-to-date and will recompile the application.

    确保在打包之前运行mvn clean,或者使用-Dgwt.compiler.force,以确保gwt:compile不会将DevMode生成的* .nocache.js文件视为最新文件,并将重新编译应用程序。