Is it possible to use a maven property to activate a profile based upon a file?

Viewed 1193

I would like to download the JACOB dlls when they're not in my local repository.

As a consequence, I have those two profiles

    <profile>
        <id>use-jacob-dll</id>
        <activation>
            <file>
                <exists>${settings.localRepository}/com/hynnet/jacob/1.18/jacob-1.18-x64.dll</exists>
            </file>
        </activation>
        <dependencies>
            <dependency>
                <groupId>${jacob.groupId}</groupId>
                <artifactId>jacob</artifactId>
                <type>dll</type>
                <classifier>x64</classifier>
                <version>${jacob.version}</version>
            </dependency>
        </dependencies>
    </profile>
    <profile>
        <id>download-jacob-dll</id>
        <activation>
            <file>
                <missing>${settings.localRepository}/com/hynnet/jacob/1.18/jacob-1.18-x64.dll</missing>
            </file>
        </activation>

But, even when download-jacob-dll has accomplished its goal, a call to mvn help:active-profiles indicates the following

The following profiles are active:

 - tests-for-eclipse (source: com.capgemini.admdt:kpitv:1.2.4-SNAPSHOT)
 - download-jacob-dll (source: com.capgemini.admdt:kpitv:1.2.4-SNAPSHOT)

I suspect it is due to the fact that I use the ${settings.localRepository} in my activation property.

Question: Is it the cause of the failure? And if so, how can I activate my profile only when dependency is missing ?

1 Answers
Related