简体   繁体   English

缺少构建路径条目:/src/test/java

[英]Build path entry is missing: /src/test/java

While running my java project on Eclipse Luna, I have some errors due to which I suppose related to this problem.I right click on the project, choose properties --> java build path --> source, I see a warning at the top:在 Eclipse Luna 上运行我的 java 项目时,我有一些错误,我想这与这个问题有关。我右键单击项目,选择属性 --> java 构建路径 --> 源,我在顶部看到一个警告:

在此处输入图片说明

And it seems that I have forgotten to add this package at the beginning of my project.I want to add it now, but I cannot do it via "Add Folder" button.When I press "Add Folder" button, a window appears like this one:而且好像我在项目开始时忘记添加这个包了。我想现在添加它,但我无法通过“添加文件夹”按钮来添加。当我按下“添加文件夹”按钮时,会出现一个窗口这个:

在此处输入图片说明

However, I believe I should add it under "Java Resources" on the tree:但是,我相信我应该将它添加到树上的“Java 资源”下:

在此处输入图片说明

How can I modify this?我该如何修改? Thanks for any help..谢谢你的帮助..

src/test/java is just maven's default entry for any test classes. src/test/java只是 maven 对任何测试类的默认条目。 If you have (or plan to have) test classes, you can create a new folder structure test/java below your src folder and afterwards select it in the dialog you've shown.如果您有(或计划有)测试类,您可以在src文件夹下创建一个新的文件夹结构test/java ,然后在您显示的对话框中选择它。 If you don't plan to have any test classes, you can safely remove the entry from the build path.如果您不打算拥有任何测试类,则可以安全地从构建路径中删除该条目。

这对我有用:

mvn clean install

How to add missing src/test/java folder to the maven project in Eclipse如何将缺少的 src/test/java 文件夹添加到 Eclipse 中的 maven 项目

1) Create a folder test/java under src folder 2) Right click on the project and choose Maven --> Update Project --> choose for Force update of Snapshot/Releases and click ok. 1) 在 src 文件夹下创建文件夹 test/java 2) 右键单击​​项目并选择 Maven --> Update Project --> 选择 Force update of Snapshot/Releases 并单击确定。 Now test folder should appear as src/test/java in Eclipse project explorer现在 test 文件夹应该在 Eclipse 项目资源管理器中显示为 src/test/java

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

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