Maven 相关知识点整理,java 基础语法的格式
======================================================================

=======================================================================

========================================================================
==========================================================================

MAVEN_HOME 环境配置:


检测 maven 配置成功的标识:

=================================================================


=================================================================

=====================================================================




=====================================================================


步骤;


<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
=======================================================================================

==========================================================================

maven 构建的 web 项目与普通的 java 项目区别在于,少了一个 wepapp 文件
==========================================================================

clean 清理的是 target 目录
=====================================================================
cmd 窗口中输入以下命令即可:

使用 maven 创建 java 项目的 pom.xml 配置演示—不使用骨架
================================================================================================
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>111</artifactId>
<version>1.0-SNAPSHOT</version>
<!--
打包方式:
1.jar: java 项目。 默认值
war: web 项目
pom
-->
<packaging>jar</packaging>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
</project>
还需要在测试目录下面,添加一个 resource 文件,这样目录结构就完整了

使用 maven 创建 java 项目的 pom.xml 配置演示—使用骨架
===============================================================================================


如果有需要可以创建两个 resource 文件,用来存放配置文件
使用 maven 创建 web 项目的 pom.xml 配置演示—不使用骨架
===============================================================================================
首先要在 pom.xml 中规定打包方式为 war 包

补齐 webapp 目录结构
================================================================================
需要配置 tomcat 插件,可以在配置插件的同时通过 port 和 path 配置端口号和虚拟目录

================================================================================


评论