将main / java类添加到intellij中的test / java目录中 [英] Add main/java classes to my test/java directory in intellij

查看:1705
本文介绍了将main / java类添加到intellij中的test / java目录中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是intellij的新手。我正在从eclispe Kepler转换。

I am new to intellij. I am switching from eclispe Kepler.

我没有maven项目,但我确实有maven目录结构。我的类在src / main / java中,我的测试在src / test / java。

I do not have a maven project, but I do have a maven directory structure. My classes are in src/main/java with my tests in src/test/java.

我的单元测试是抱怨的,因为他们无法从src /找到类主/ JAVA。将它添加到构建路径的正确方法是什么,以便我的单元测试可以找到源?

My unit tests are complaining because they can't find the classes from src/main/java. What is the proper way to add this to the build path so that my unit tests can find the source?

推荐答案


  • 右键单击src / main / java目录并选择将目录
    标记为> Sources root。

  • 右键单击src / test / java 目录并选择标记目录
    为>测试源根

  • 此外,请确保使用源下的包文件夹。

    Also, make sure you use packages underneath your source folders.

    这篇关于将main / java类添加到intellij中的test / java目录中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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