maven 子模块排除 spring-boot-maven-plugin

百里智勇
2023-12-01

场景

  • 有maven项目A
  • 项目A下面有模块B、C、D、E、F
  • maven A 配置了插件 spring-boot-maven-plugin 希望其下的所有模块都自动执行
  • 现在新增了一个模块 G,模块 G 不希望继承执行这个插件
  • 在不修改 maven A 的情况下,按照如下配置可以对 G 禁用不执行插件 spring-boot-maven-plugin

Maven A的配置如下

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<classifier>exec</classifier>
				</configuration>
			</plugin>
		</plugins>
	</build>
	
	<modules>
		<module>B</module>
		<module>C</module>
		<module>D</module>
		<module>E</module>
		<module>F</module>
		<module>G</module>
    </modules>

给模块 G 按如下配置

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>

skip 插件即可


(END)

 类似资料: