Maven's three engineering pom, jar, war

Three types of projects in maven:

1.pom project: used in parent project or aggregate project. Used for version control of jar packages.

2. War project: The project that will be packaged into war and published on the server. such as a website or service.

3.jar project: It will be packaged into a jar for use as a jar package.

Take Taotao Mall as an example:

1. pom project

     1. taotao-parent:

       taotao-parent is the parent project of the entire project, it is a pom project. It is used for version control of the entire project, that is, the versions of all jar packages to be used in the project are centrally managed by the parent project. In this way, you don't need to write the version number when writing maven dependencies in other project pom files. Of course, all projects must inherit it first.

      2.taotao-manager:

       Create taotao-manager for aggregation project, it is also a pom project. Create four models are taotao-manager-pojo, taotao-manager-dao, taotao-manager-service, taotao-manager-web, and automatically generate 4 independent maven projects. The aggregation project is just a tool used to help other modules build, and has no substantial content itself. The specific writing of each project code is still written in the generated project.

       2.1. The meaning of using the aggregated project taotao-manager is that these modules were originally independent projects, but now they are aggregated into taotao-manager, so that when we build a project, we only need to build one taotao-manager. We only need to use maven to build this aggregate project taotao-manager without worrying about the construction of the module. For example, when installing, just install taotao-manager. In short, to simplify the operation. The normal coding work is still in the corresponding taotao-manager-pojo, taotao-manager-dao, taotao-manager-service, taotao-manager-web. carried out in the project.

2. war project

        1.taotao-rest, taotao-portal these

        These projects are to be deployed on the server, so they must be packaged into war form. Some of these projects are directly accessed by users through browsers, and some are called by other projects through publishing services.

Three.jar project

       3.taotao-common

        This is the project packaged into a jar. It is to store some classes and tool classes that other projects will use. We can refer to it in the pom files of other projects, which is no different from referencing other jar packages.

      <dependency>
<groupId>com.taotao</groupId>
<artifactId>taotao-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>

Guess you like

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