二 MyBatis 从入门到进阶 2 Maven 入门
1 Maven 的使用
1.1 本地仓库与中央仓库

本地仓库:Window \ Preferences \ Maven \ User Settings \ Local Repository
中央仓库:
- 代理服务器 / 私服 / 备份服务器
- maven.aliyun.com,public Repository
创建私服:pom.xml
1 <repositories> 2 <repository> 3 <id> aliyun </id> 4 <name> aliyun </name> 5 <url> https://maven.aliyun.com/repository/public </url> 6 </repository> 7 </repositories>
1.2 修改本地仓库地址
- apache-maven-3.6.0 \ conf \ settings.xml, <localRepository> e:/maven-repo </localRepository>
- Window \ Preferences \ Maven \ Installations, Window \ Preferences \ Maven \ User Settings
1.3 IDEA 操作 Maven
1.3.1 IDEA Configure
- Configure \ Settings \ Build, Execution, Deployment \ Build Tools \ Maven
- Maven home directory / User settings file / Local repository
1.3.2 Create New Project \ Maven
- GroupId: com.imooc
- ArtifactId: idea-maven
- Version: 1.0.0-RELEASE
1.3.3 标准 Maven 工程
- src
- main / test
- main \ java, resources
- test \ java
2 Maven 常用命令
2.1 junit 依赖
1 <dependencies> 2 <dependency> 3 <groupId>junit</groupId> 4 <artifactId>junit</artifactId> 5 <version>4.12</version> 6 </dependency> 7 </dependencies>
2.1.1 不再支持源选项 1.5。请使用 1.6 或更高版本。
1 <properties> 2 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 3 <maven.compiler.source>1.8</maven.compiler.source> 4 <maven.compiler.target>1.8</maven.compiler.target> 5 </properties>

浙公网安备 33010602011771号