运行生成超长命令行的Java测试时避免错误? [英] Avoid error when running java tests which generate super long command lines?

查看:74
本文介绍了运行生成超长命令行的Java测试时避免错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到一个:

Exception occurred executing command line.
CreateProcess

从Eclipse运行时,由于命令行太长(库太多,罐子路径太长)而导致. 对我而言,唯一的解决方案是按配置运行...然后创建配置,删除所有默认依赖项,并仅手动添加所需的内容,这样命令行就不会中断.

Cause by a too long commandline (too many libraries, too long path to the jars) when running from eclipse. The only solution for me is to go to run as configuration... then create a configuration, remove all default dependencies and manually add only the things which are required, so the commandline does not get cut off.

我通常在jUnit测试中这样做.

I normally do this for jUnit tests.

这是浪费时间,有其他解决方法吗?

This is a waste of time, is there a different solution?

谢谢

推荐答案

如果您使用的是Java> = 6,则可以使用

If you're on java >= 6 you can use classpath wildcards.

这应该足够了,除非您将jar分散在文件系统中,这需要进行一些清理.

That should be enough unless you have your jars scattered around the filesystem, which would call for some cleanup.

修改

如果只是在Eclipse中使用run as junit test运行junit测试,则可以定义用户库"并将其添加到类路径中.虽然还没有进行测试,但是它可能会限制Windows中环境变量长度的限制,但是我认为这是最安全的选择.

If you're simply running junit tests with run as junit test in eclipse then you can define 'user library' and add that to the classpath. Haven't tested it though, and it might suffer from some limits on environmental variable length in windows, but i think that's the safest bet.

edit2

您可以尝试此插件. https://stackoverflow.com/a/8362775/642340>此答案.它适用于靛蓝,所以我想它将适用于日光灯.

You can try this plugin mentioned in this answer. It worked on indigo, so i guess it will work on helios.

这篇关于运行生成超长命令行的Java测试时避免错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆