Build a multi-module maven project

1. Open the idea, new project

Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description

Delete src folder

Here Insert Picture Description

2, a jar of the new module

Here Insert Picture Description
Here Insert Picture Description
We created a common project of the module
we talk pom files in the project to see the system automatically join the common this module
Here Insert Picture Description
we enter the common module pom file, the introduction of the root item pom
Here Insert Picture Description

2, a new module of war

Here Insert Picture Description

We check on the create form archetype options

Here Insert Picture Description

We found more than a webapp talk to modules pom file project

Here Insert Picture Description

We file into the webapp's pom, pom root project introduction and war

Here Insert Picture Description
Here Insert Picture Description

New java folder and the resources folder

Here Insert Picture Description

But these two documents did not change color, not the real sources and resources folders, we continue to operate

Here Insert Picture Description

Observe the color and logo java and resources folders

Here Insert Picture Description

java webapp in the new file folders, a subsequent operation to

Here Insert Picture Description

3, dependent on the introduction springboot

1), with the pom file
by adding the following dependence on outside dependencies

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.0.3.RELEASE</version>
 </parent>

Join in what dependencies dependent

 <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
  </dependency>

   <dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

Here Insert Picture Description
2), in the webapp pom file
by adding the following dependencies in the dependency

    <dependency>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-starter-web</artifactId>
       </dependency>

Here we import the common module Here Insert Picture Description
3), the new file application.yml resources, set the start port 8080 Tomcat Here Insert Picture Description
4), a new java file at start

 @SpringBootApplication
public class WebApplication {
    public static void main(String[] args) {

        SpringApplication.run(WebApplication.class, args);
    }

}

Here Insert Picture Description
5), right on the start springboot WebApplication files
Here Insert Picture Description
we have started up, and in the log we can see the start port 8080Here Insert Picture Description

Guess you like

Origin blog.csdn.net/k393393/article/details/91371971