I don’t have much experience with Maven in combination with Android, so I followed these instructions to create a new project for Android. After making a project I get the following error message:
When I try to add a new source directory via New->Other->Java source directory with src/test/java, I get another error message :
But I don’t have the src/test/java file in the project. How do you do that? What a great way to set up a project, because I think there’s something missing from these instructions. So, what time does Maven src/test/java appear?
I use Eclipse Juno, m2e 1.1.0, Android configuration for m2e 0.4.2.
How can I solve this problem?
I understand this too, because the latest update of the m2e-android plugin (version 0.4.2) happens both when you create a new project and when you import an existing project (unless you use src/test/java).
It seems that m2e-android (or maybe m2e) is now always trying to add src/test/java as the source directory in the .classpath file, whether or not it exists in your project directory :
Because it has already been added to the project metadata file, Eclipse complains that the classpathentry is already there when you try to add the source directory via Eclipse:
There are several ways to solve this, the simplest is to manually create the src/test/java directory in the file system and then update the project by pressing F5 and running Maven -> Update Project (right click on the project, Maven -> Update Project…), this should fix the missing source directory: the ‘src/test/java’ error.
We can change the java file from
- Construction Path -> Source.
- Click on the Add folder button.
- Select the main unit as the container.
- Click on the Create folder button.
- Enter the folder name as java.
- Click on Ready
I’m fine. I’m fine.
First I solve the problem by creating a folder named src/test/resources, then I rename the folder to src/test/java, then I recreate the folder src/test/resources, it works.
This may have been caused by the loss of the home directory.
Right click on the src folder -> Change source folder
Solution No 5:
I had the same problem, I solved it.
Create the missing folder directly in the file system (e.g. with Windows Explorer).
And then update your project under the Eclipse.
Solution No 6:
This is a bug in the Android connector for M2E (m2e-android) that has recently been repaired:
This fix has been merged and will be available at the next release. In the meantime, you can test the new patch by installing it from the nearest update site:
Solution No 7:
Remove the m2 plugin from the launch plugin list and launch Maven->Update projects on all projects that worked for me.
Note** You do not need to create additional folders to prevent merging when using SVN/Git-based branches.
Solution No 8:
In the case of the Maven project
Try right-clicking on the project and then select Maven -> Update Project….. (Refreshes the project) and then Ok.
Solution No 9:
Select the project -> New -> folder (not the source folder) -> select the project again -> enter the folder name as (src/test/java) -> finished. Here’s how.
If no test source is present, it will be linked automatically. If not, you’ll have to pair it up manually.
maven source folder eclipse,maven src/main/java package,src/main/resources missing,do not see the src main java and src test java folder in your project structure,cannot nest src/test/java' inside src maven,how to create src/test/resources in eclipse with maven,how to add source folder in eclipse java,test source folder 'src/test/java' in project must have a separate output folder,missing required source folder: 'src main java,eclipse project is missing required source folder: 'src main java,source folder is not a java project error in sts,src/main/java missing intellij,how to create src/test/resources folder,src/main/java missing intellij maven project