How to deal with missing src/test/java source folder in Android/Maven project?

Viewed 136733

I'm not very experienced with Maven in combination with Android yet, so I followed these instructions to make a new Android project. When the project has been created, I get the following error message:

Project 'xxx-1.0-SNAPSHOT' is missing required source folder: 'src/test/java'

When I try to add a new source folder with New->Other->Java-Source Folder with src/test/java, I get another error message:

The folder is already a source folder.

But I don't have any src/test/java folder in my project. How should I deal with that? What's the clean way to setup the project, because I assume that there is something missing in this instruction. So what is the Maven way to let src/test/java appear?

I'm using Eclipse Juno, m2e 1.1.0, Android Configuration for m2e 0.4.2.

10 Answers

In the case of Maven project

Try right click on the project then select Maven -> Update Project... then Ok

Select project -> New -> Folder (not source folder) -> Select the project again -> Enter the folder name as (src/test/java) -> finish. That's it.

If the test source is missing, it would link it automatically. If not, then require to link it manually.

Fixing this issue is really very simple, Just Right Click on the project go to Properties. After that go to Build Path, You see an error like ” 2 build path entries are missing “ This error usually comes when the JRE System Library is wrongly pointed. Now go to the Libraries tab and change the JRE System Library to the correct version by clicking on Edit.

Here is the complete Tutorial: https://kkjavatutorials.com/how-to-fix-missing-src-main-java-src-test-java-folders-in-the-eclipse-maven-web-project/

Related