简体   繁体   English

m2eclipse工作区分辨率类别和测试文件夹

[英]m2eclipse workspace resolution classpth and test folder

I am using m2eclipse for manage my classpath in eclipse, and i have a problem when i want use test-compile goal in eclipse. 我正在使用m2eclipse在eclipse中管理我的类路径,当我想在eclipse中使用测试编译目标时遇到问题。

i have 2 projects A & B, project B depend A for class (in folder target/classes) and test class (in folder target/test-classes). 我有2个项目A和B,项目B依赖A的类(在文件夹目标/类中)和测试类(在文件夹目标/测试类中)。 If I run test-compile goal in m2 eclipse launcher with parameter M2_WORKSPACE_RESOLUTION=true the compilation can not find test classes of project A. 如果我在M2日食启动器中使用参数M2_WORKSPACE_RESOLUTION = true运行测试编译目标,则编译找不到项目A的测试类。

In command line everythings are ok. 在命令行中一切正常。 If I use M2_WORKSPACE_RESOLUTION=false everythings are ok. 如果我使用M2_WORKSPACE_RESOLUTION = false,则一切正常。

How can I force m2eclipse to use test class with workspace resolution ? 如何强制m2eclipse使用具有工作空间分辨率的测试类?

You have to declare a dependency on the test classes of project A explicitly. 您必须显式声明对项目A的测试类的依赖。 See this question on how to do that. 有关如何执行操作的信息,请参见此问题 Test classes are normally not packaged in the artifact. 测试类通常不打包在工件中。 That's why you can't access those classes from project B. 这就是为什么您无法从项目B访问这些类的原因。

it's an issue of M2eclipse: 这是M2eclipse的问题:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=352962 https://bugs.eclipse.org/bugs/show_bug.cgi?id=352962

The dependency resolution will work (it seems) with in the JVM that is running Eclipse. (似乎)依赖关系解析将在运行Eclipse的JVM中起作用。 But if another JVM is launched then it won't. 但是,如果启动了另一个JVM,则不会。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM