搭建maven环境
- 环境变量
- MAVEN_HOME --> Maven安装路径
- M2_HOME --> Maven的bin目录
- Path --> %MAVEN_HOME%\bin
- 测验
- mvn -version
- 新建本地仓库
- 配置setting.xml
- 本地仓库
<!--本地仓库--> <localRepository>D:\Environments\maven\apache-maven-3.8.2\maven-repo</localRepository>
- 阿里云镜像
<!--阿里云镜像--> <mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public/</url> <mirrorOf>central</mirrorOf> </mirror>
- 本地仓库
在idea中配置maven
- 配置maven的安装地址
- 配置maven的设置文件
- 配置maven的本地仓库
- VM Options:-DarchetypeCatalog=internal
新建MavenWeb项目
maven的使用
- 编译版本
<properties> <java.version>1.8</java.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <maven.compiler.source>${java.version}</maven.compiler.source> <maven.compiler.target>${java.version}</maven.compiler.target> </properties>
- 资源导出问题
<!--项目构建使用的配置--> <build> <!--解决资源导出问题--> <resources> <resource> <directory>src/main/resources</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>true</filtering> </resource> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>true</filtering> </resource> </resources> </build>