[英]How do I execute a specific version of Maven plugin goal from command line using plugin prefix?
[英]How do I execute maven plugin for parent module only?
因此,我创建了这个小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>
在评论中回答:
您应该在插件的mojo中添加@aggregator批注。 – Andrew Logvinov 13年4月1日在12:40
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.