maven reversion管理多模块版本号
在多模块的项目中, 常常就只是改一个版本号, 就改动了所有的模块;比例使用mvn versions:set -DnewVerion=xx -DprocessAllModules命令,将代码提供到git上时,就会出现这种情况:
要改变这种情况,可以使用flatten-maven-plugin + reversion 避免。
操作步骤如下:
1、添加pom.xml配置
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.springcloud.gray</groupId>
<artifactId>spring-cloud-gray</artifactId>
<packaging>pom</packaging>
<!-- 使用reversion代替版本号 -->
<version>${revision}</version>
<properties>
<!-- Project revision -->
<revision>D.0.1.0-Beta-1</revision>
</properties>
<build>
<defaultGoal>spring-boot:run</defaultGoal>
<plugins>
<!-- 添加flatten-maven-plugin插件 -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>${maven_flatten_version}</version>
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>resolveCiFriendliesOnly</flattenMode>
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
idea maven 内存不足
如果IDEA里为Maven的importer设置的JVM最大堆内存(-Xmx)过小而导致的过小,会导致idea maven报错:java.lang.OutOfMemoryError:GC overhead limit exceeded
解决方法
打开IDEA设置,找到Maven -->Importing选项卡,设置VM options for importer 中的最大内存,默认是768m, 可以设置大一些
重新打开或者刷新idea maven即可