所以我创建了这个小型 maven 插件,它将连接到数据库服务器并创建项目所需的所有表。问题是,该项目由多个模块组成,我希望插件在父模块中定义。然而它只需要执行一次,而不是为每个模块单独执行。我认为添加"<inherited>false</inherited>"
到插件配置就足够了,但显然不是。这是我的父项目的pom:
<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>rpg</groupId>
<artifactId>rpg-build</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>rpg-build</name>
<modules>
<module>../rpg-web</module>
<module>../rpg-service</module>
<module>../rpg-commons</module>
<module>../rpg-maven-plugin</module>
</modules>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.2.9</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>rpg.maven.plugin</groupId>
<artifactId>rpg-maven-plugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<inherited>false</inherited>
</plugin>
</plugins>
<finalName>${artifactId}</finalName>
</build>
</project>