【发布时间】:2016-12-13 09:10:29
【问题描述】:
我正在尝试打印正在运行 Maven 项目构建的当前配置文件。
我使用maven-antrun-plugin 结合引用当前配置文件的属性在控制台上打印消息。
我尝试了以下属性:
${project.activeProfiles[0].id}
${project.profiles[0].id}
但在这两种情况下,它都会在写入时打印“字符串”,而不解析变量。
这是我的测试:
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo>current active profile: ${project.activeProfiles[0].id}</echo>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
但这是我得到的结果:
main:
[echo] current active profile: ${project.activeProfiles[0].id}
任何建议将不胜感激。
谢谢。
【问题讨论】:
-
为什么要具体做,这要看个人资料?
标签: maven maven-antrun-plugin maven-profiles