Maven - 使用变量激活配置文件
Maven - profile activation with variables
我的 Maven 配置文件自动激活有问题。
当我使用变量时(例如 ${project.basedir})它不起作用。
<profiles>
<profile>
<id>prof1</id>
<activation>
<file>
<exists>${project.basedir}\mark.txt</exists>
</file>
</activation>
<build>
<plugins>
<plugin>...
当我写没有变量的路径时,它完美地工作:
<profiles>
<profile>
<id>prof1</id>
<activation>
<file>
<exists>C:\projects\trainings\own\MavenPrj\mark.txt</exists>
</file>
</activation>
<build>
<plugins>...
文件C:\projects\trainings\own\MavenPrj\mark.txt当然存在
我的 Maven 版本是 3.0.4。
问候
探险
来自 Maven 的 Introduction to Build Profiles :
As of Maven 2.0.9, the tags <exists> and <missing> could be interpolated. Supported variables are system properties like ${user.home} and environment variables like ${env.HOME}. Please note that properties and values defined in the POM itself are not available for interpolation here, e.g. the above example activator cannot use ${project.build.directory} but needs to hard-code the path target.
我的 Maven 配置文件自动激活有问题。 当我使用变量时(例如 ${project.basedir})它不起作用。
<profiles>
<profile>
<id>prof1</id>
<activation>
<file>
<exists>${project.basedir}\mark.txt</exists>
</file>
</activation>
<build>
<plugins>
<plugin>...
当我写没有变量的路径时,它完美地工作:
<profiles>
<profile>
<id>prof1</id>
<activation>
<file>
<exists>C:\projects\trainings\own\MavenPrj\mark.txt</exists>
</file>
</activation>
<build>
<plugins>...
文件C:\projects\trainings\own\MavenPrj\mark.txt当然存在
我的 Maven 版本是 3.0.4。
问候 探险
来自 Maven 的 Introduction to Build Profiles :
As of Maven 2.0.9, the tags <exists> and <missing> could be interpolated. Supported variables are system properties like ${user.home} and environment variables like ${env.HOME}. Please note that properties and values defined in the POM itself are not available for interpolation here, e.g. the above example activator cannot use ${project.build.directory} but needs to hard-code the path target.