Maven project development steps (1) Based on the springboot

springboot in java project used more and more, today recorded about to develop a project based on javaEE springboot, you need to how to do.

1, first of all should go to the official website springboot generate a Springboot project. Official website address: https://start.spring.io/

2, start setting some basic properties of the project. Including: project is a maven project or gradle project, what is the development of language, Springboot version. As well as how to group projects package, the name of the project.

image.png


3, after set up, according to project needs, add some related dependencies. For starters you can ignore this step.

4. Click Generate the project will be a button to download Springboot project framework. It is a compressed form of packets.

QQ screenshot 20190820165324.png

5, the downloaded archive decompression. Next we open the eclipse, just import the downloaded items. eclipse → File → Import

image.png

6, select maven → Exist Maven Projects, click next.

image.png

7, choose our project file. Click Finish to import.

image.png

8, items frame as follows: wherein the red box HxschoolApplication.java file is automatically generated. The entire project startup files. It should be noted that , the package containing the file must be "top-level package" . That project where all the files to be included in the "Top package" inside.

For example, I created a new project in com.hx.controller package and com.hx.service package. Both packages are included in the "Top Package" com.hx bag. So as to ensure that the project start properly, otherwise it will error.

image.png

9, then we test whether the project can be run. Select the file HxschoolApplication.java, Right-click selection"Run as" → "Java Application " or "Springboot App" .

The following occurs represents a successful start!

image.png

Shown here is to explain the information to start the project with a long (1.97s) time, it represents a successful start.

image.png

[Description] If your project pom.xml first line of the error, but the project can be started successfully, you can <properties> add the tag <maven-jar-plugin.version> 3.0.0 </ maven-jar-plugin .version> , then again to update the project. Update ways: Right-click on the selected item → OK → Maven → Update Project →. Figure:

image.png

10, after a successful start, we began to develop our project.

Guess you like

Origin blog.51cto.com/13082457/2431409