Create a maven project in Eclipse, cannot add source folders such as src/main/java

Create a Java Web project through Eclipse. The directory structure is as follows:

By default, only the source folder of src/main/resources is

in accordance with the maven directory structure, and src/main/java; src/test/java; src/test/resources, etc. are also required



in eclipse When creating these source folders, the following situations will occur: The


solution is as follows: Two methods

1. Open the Navigator directory of Eclipse, create the missing source folders in turn, and then set the output folder and other information as in Method 2.

  Windows -> Show View -> Navigator

  This directory can see the directory structure of the project on the hard disk.

  For more information about Eclipse settings, please refer to another blog: http://www.cnblogs.com/FocusIN/p/6403489.html



2. Do the following

1. Open the build path of the project, we see the following information , in fact, those source folders exist, just show missing



2. Select the two missing source folders, then click Remove on the right

3. Then add the source folders in turn

4. But next, we still go back to the build path , and see the following situation: The newly created source folder does not have an Output folder set

, so we can do the following settings:

a. Select the source folder, click Edit on the right, then the second item, select a specific folder

b. Set the

result as follows:

custom, set the Output folder of src/test/resources to "target/test-classes".

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326114619&siteId=291194637