MAVEN 相關
1. 通过dependency:tree是命令来检查版本冲突
mvn -Dverbose dependency:tree
2.install 成功 build 报包找不到
mvn终端 mvn idea:idea (下载未下载完成的包)
invalidate caches 重新启动idea
3.获取构建时间:
a.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create-timestamp</goal>
</goals>
<configuration>
<timestampFormat>yyyy-MM-dd HH:mm:ss</timestampFormat>
</configuration>
</execution>
</executions>
</plugin>
b.
<properties>
<project.build.timestamp>@timestamp@</project.build.timestamp>
</properties>
c. properties文件配置
project.build.timestamp =@project.build.timestamp@
4.jar 打包 依赖包分离
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
<manifestEntries>
<Class-Path>./</Class-Path>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
<addResources>true</addResources>
<includeSystemScope>true</includeSystemScope>
<includes>
<include>
<groupId>not-exists</groupId>
</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>