微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

maven一些命令

1. 查看依赖包树

mvn dependency:tree -Dverbose

2. maven通过命令修改版本号
mvn versions:set -DnewVersion=1.0.1.0.0-SNAPSHOT
mvn versions:commit
或者
mvn versions:set -DnewVersion=1.0.1.0.0-SNAPSHOT -DgenerateBackupPoms=false

编译: mvn compile

打包: mvn package
清除缓存文件: mvn clean
安装到本地仓库: mvn install
3 跳过测试模块
-Dmaven.test.skip=true

4 添加打包插件, 并指定主方法启动类

<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.2.8.RELEASE</version>
<configuration>
<mainClass>com.example.TestSftp</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
5 指定字符编码和jdk版本

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
<java.version>11</java.version>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
6 maven跳过证书下载包 mvn clean install -Dmaven.test.skip=true -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true -U

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐