一 pom引入本地包
<dependency>
<groupId>oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/lib/ojdbc6-11.2.0.3.jar</systemPath>
</dependency>
二 跳过test打包
<properties>
<skipTests>true</skipTests>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
三 设置mapper.xml不在resource文件下
还需要对应的yml配置 设置mybatis
mapper-locations: classpath*:com/包名/包名/dao/*Mapper.xml
<build>,
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>
设置jdk版本
每个模块都需要添加
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
仓库地址
<repositories>
<repository>
<id>nexus-aliyun</id>
<name>Nexus aliyun</name>
<layout>default</layout>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<!--配置阿里云镜像-->
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>central</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
配置打包名称
<build>
<finalName>${project.artifactId}-1.1.0</finalName>
</build>
自定义pom版本依赖
<elasticsearch.version>7.7.0</elasticsearch.version>
常用依赖
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.11</version>
</dependency>
修改版本
升级
## mvn versions:set -DnewVersion=1.0.3-SNAPSHOT
mvn versions:set -DnewVersion=1.0.1
回退
mvn versions:revert
版本读取
上面的版本优先读取
安装本地jar包
mvn install:install-file -Dfile=C:\Users\Administrator\Desktop\netpay.jar -DgroupId=CCBSign -DartifactId=RSASig -Dversion=1.0 -Dpackaging=jar
指令
mvn -pl 指定模块打包
mvn -U 强制刷新本地仓库不存在release版和所有的snapshots版本。
-B,-批处理模式以非交互方式运行(批处理)模式(禁用输出颜色)
-f,-file 强制使用备用POM文件(或带有pom.xml的目录),pom文件路径必须紧跟在 -f 参数后面