【问题标题】:executable configuration is not working in maven plugin可执行配置在 Maven 插件中不起作用
【发布时间】:2019-10-04 05:40:54
【问题描述】:

我有一个多模块 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>

【问题讨论】:

  • 为什么需要在 Maven 构建中运行 bash 脚本?目的是什么 ?你想解决什么样的问题?

标签: maven exec-maven-plugin


【解决方案1】:

很遗憾,您无法按照您的要求进行操作。对于配置文件,Maven 仅插入命令行上提供的属性。 This answer 更详细。

【讨论】:

    猜你喜欢
    • 2018-07-20
    • 1970-01-01
    • 2023-03-12
    • 1970-01-01
    • 2016-02-03
    • 1970-01-01
    • 2018-03-15
    • 2013-07-04
    • 2018-09-03
    相关资源
    最近更新 更多