可执行配置在Maven插件中不起作用

时间:2019-05-16 21:58:23

标签: maven exec-maven-plugin

我有一个多模块Maven项目,在验证阶段,我希望一个插件在构建子项目之一时运行bash脚本。我已经在父项目中定义了exec-maven-plugin,并带有脚本文件的路径,并将阶段作为子项目的参数传递给该项目。但似乎控制直到  

          parent project
                       |_ childProject 1(project where the script file has to run before compilation)
                       |
                       |_ childProject 2
                       |
                       |_ childProject 3


 parent pom:
        <profiles>    
          <profile>
             <id>my-profile</id>
              <build>
               <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>my-execution</id>
                            <phase>${phase.prop}</phase>
                            <configuration>
                                <executable>./file.cmd</executable>
                            </configuration>
                            <goals>
                                <goal>exec</goal>
                            </goals>                        
                          </execution>
                         </executions>
                       </plugin>
                      </plugins>
                     </build>
                    </profile>
                   </profiles>

 ChildPom1:

    <properties>
         <phase.prop>validate</phase.prop>
    </properties>

1 个答案:

答案 0 :(得分:0)

很遗憾,您无法做您想做的事情。对于概要文件,Maven仅插值命令行上提供的属性。 This answer更加详细。

相关问题