Maven project summary notes

1, maven lifecycle methods:

complie, test, package, install and so on.
The meaning of each command: complie is compiled meaning. It is to generate .class files in the target directory. packed package is meant to produce something in the target directory. jar is mounted install package to the local repository.

2, maven project you want to import coordinates jar package, it is necessary to resolve the conflict jar package.

1) a solution to the conflict jar package:

The first statement priority principle: the coordinates of which jar package in the upper position, the jar package is the first statement. Dependencies jar package under the coordinates of the first statement, they can enter the priority projects.

3, maven jar package introduced some concepts

Directly dependent on: project directly into a jar, the package is directly dependent on the project.
Transmitting dependency: the project is not directly introduced into the jar package, the package may depend jar passed directly through to the project to the project.

2) resolve the conflict two jar package:

Path recently, the principle of priority: direct path-dependent than the path near transitive dependencies, then the final project into the jar package will be directly dependent on the path near the package.

3) resolve the conflict jar package three:

(No using the third embodiment), the direct exclusion (negative dependencies within this package). When we want to exclude dependencies in a jar package, when configuring excluions tags, internal version number can not write, because at this time the use of version dependencies and packages as default and this jar.

4, maven project that can be divided into a parent-child dependencies.

After all depend on other projects, other projects to get the dependencies, they are all transitive dependencies.
For example: A current project is dependent on project B, then we project all A jar package will be delivered to the B to the project, these jar package B obtained in the project are all transitive dependencies. B project developers If we import a ssm in the framework of the project jar package B, B for the project is directly dependent, less directly dependent jar package will pass us A project in the past jar package overwritten. To prevent these problems, we can put a jar coordinate A major project in the lock, then the other dependencies of the project even if the project is directly dependent jar package of the same name can not be overwritten.
Solution:

// properties文件方便以后修改,好找,如果有多个文件,不会太乱。
 <properties>
	<spring.verson>3.23<spring.version>// 这里相当于键值对。下面通过el表达式引入进去。
</properties>

// 这个是锁定jar包版本,被其他依赖后他就不能被覆盖啦。
<deperencyManagement>
	<dependency>
		<groupId>com.itheima<groupId>
		<artifactId>Demo<artifactId>
		<version>${spring.version}</version>
	</dependency>
</deperencyManagement>
// 上下这两个都需要写,上面的只是起到锁定的作用,下面才是真正的引入。
<dependencyies>
	<dependency>
	...
	</dependency>
</dependencies>
// xml文件能写入什么标签,完全取决于头上面的约束。

5, maven created using the skeleton project directory structure is not complete, we need to manually filled. Skip create a project directory structure skeleton is intact.

The difference between engineering and module: This refers maven project.

  • Project does not mean a complete project, the module does not mean a complete project, a complete project to see the code, the code can be said to complete a complete project, and this project is not related to the project and modules.
  • Project born only use internal resources, project born independent. Acquired can build relationships with other projects or modules. Module born not independent modules naturally belongs to the father of the project, once the module is created, all the resources of the parent project can be inherited use.
  • References between the same level called dependency, dependent not innate, is the need to rely on acquired established.

1, aop is Oriented Programming: starting point is a combination of cut and notifications.

Generally, we write to express their own class using the annotation form. The system provides class configuration file is written to them.

6, three ways to start the project maven

  1. Directly through the Tomcat plug-in starts maven parent project. (Remember that the parent project)
  2. If you start module web module, you must first install install other dependent modules before they can start properly, usually the father works directly install to install the following modules will follow automatically installed.
  3. Start by external Tomcat server. web module does not need to start.
发布了5 篇原创文章 · 获赞 0 · 访问量 81

Guess you like

Origin blog.csdn.net/weixin_43981131/article/details/104101963
Recommended