Create a maven project to generate a WebRoot directory, a web.xml file, and a solution to modify the compilation path classess

      Create a maven project: First File-->New-->Maven Project to the following interface:

        

    Click Next to the following interface:

        

    Click Next to enter the following interface:

        

     Enter webapp in the Filter box, double-click the second one, and go to the following interface:

        

    Enter Group Id, Artiface Id and click Finish, and a maven project is created successfully. ( Group Id and Artiface Id are defined by themselves ), the created maven project structure is as follows:

        

    Obviously the structure is not what I want: first create a java folder in the main directory of src. After the creation is complete, the directory structure is as follows:

        

    Next, generate the WebRoot directory and the web.xml file in the WebRoot directory:

        Right-click the project and select Properties to enter the following interface:

        

    Click on Project Facets, the right interface appears, select Dynamic Web Module, the place within the red circle appears below, and then click on the content in the red circle, the following interface will appear: (Note: If your Dynamic Web Module is selected, first Uncheck, save, and do the above again )

        

    Follow the steps above, and keep clicking OK. The completed project directory structure is as follows:

        It looks more comfortable. Let's continue:

    Next, modifying the compilation path of the project is also a problem that has been bothering me for a long time. Fortunately, it has been solved. The solution steps are listed below:

        Right-click the project-->Build Path-->Configure Build Path to the following interface:

        

    Click OK, do you think you're done just like me? Next run the following program:

        

    Sorry, wrong report. How to deal with it? Open the pom.xml file under the project,

        

    Find that <outputDirectory> is still the default build path for maven, then click the pom.xml tab to find the <build> tag:

        

    After the configuration is complete, run the following program:

        

    It worked! ! It's not easy. It took me several hours to figure it out. I hope it can help everyone. Please bear with me if I don't write in detail. common progress

        

Guess you like

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