maven reversion管理多模块版本号

maven reversion管理多模块版本号

在多模块的项目中, 常常就只是改一个版本号, 就改动了所有的模块;比例使用mvn versions:set -DnewVerion=xx 命令,将代码提供到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即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值