PeterB
PeterB

Reputation: 323

Maven - profile activation with variables

I've got problem with auto-activation of my maven profile. When I use variables (e.g. ${project.basedir}) it doesn't work.

    <profiles>
    <profile>
        <id>prof1</id>

        <activation>
            <file>
                <exists>${project.basedir}\mark.txt</exists>
            </file>
        </activation>
        <build>
            <plugins>
                <plugin>...

When I write path without variables, it works perfect:

    <profiles>
    <profile>
        <id>prof1</id>

        <activation>
            <file>
                <exists>C:\projects\trainings\own\MavenPrj\mark.txt</exists>
            </file>
        </activation>
        <build>
            <plugins>...

The file C:\projects\trainings\own\MavenPrj\mark.txt of course exists.

My Maven Version is 3.0.4.

Regards Piotrek

Upvotes: 0

Views: 2025

Answers (1)

Milen Dyankov
Milen Dyankov

Reputation: 3052

From Maven's 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.

Upvotes: 2

Related Questions