maven - 可执行配置在 Maven 插件中不起作用
问题描述
我有一个多模块 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 仅插入命令行上提供的属性。这个答案更详细。
推荐阅读
- android - Android Manifest 合并失败,Material Date Time Picker
- c# - 从 WPF/C# 连接到 USB 收据打印机
- r - 从 requirements.txt 文件安装 R 包
- google-play - Google Play 管理中心帐号所有者没有所有者权限
- javascript - 如何在使用 ws npm 模块的 javascript 中使用 ws.send() 时发送 EOF
- python - 转换 .bat 文件以打开和加载 putty 会话到 Python
- php - Mailgun API - 发送多个附件
- sql-server - SQL Server 自动启动例程
- python - Windows SSL 证书存储和 Python LDAP
- java - 我应该在 OnBindViewHolder() 方法中设置 ReyclerView 的 Item 的 OnClickListener 吗?