Build a directory of Java projects like Maven to better manage the source code for Java Engineering

Source: Internet
Author: User
Tags java web

Know that Maven has the ability to manage Java or javaweb. What I personally particularly fancy is the separation of its code hierarchy. Different codes are under different folders. This is a new normal project in eclipse that cannot be achieved. And if you use Maven sometimes it seems a bit unnecessary, especially when practicing writing code. Can you manually modify the directory structure of a common Java project to a directory structure similar to MAVEN-managed projects? This is of course possible.

The directory structure of the MAVEN project:

It can be seen that the directory of MAVEN built Java Web Project is very hierarchical, the Src/main/java directory is generally the main code of the project, the Src/main/resource directory is a number of project-related configuration files; src/test/ In the Java directory, some of the test code is typically stored: for example, the unit code written by the test framework, or some simple main function.

Okay, here's a look at how to change the directory structure of an ordinary Java project to be as hierarchical as a MAVEN project.

1. Create a new Java project or a Java Dynamic Web project.

2. Delete the SRC directory under the new test project in the first step.

3, right-click the project "Properties, search Java build path, select Java build Path," Select the Source tab, "click Add Folder. Button.

4. Pop up the source folder selection box and click Create New folder. Button. Enter the folder name (you can enter it by path, such as Src/main/java).

5, click Finish,ok to complete the creation of the directory.

6, the final effect.

Build a directory of Java projects like Maven to better manage the source code for Java Engineering

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.