I'm trying to add a system
scoped dependency to my POM. The trick is that I do not have the systemPath
. Instead, I have a path to a properties file that contains a property that I can use as the path.
I've tried to use the properties-maven-plugin to deal with this, but it seems that the system dependency gets resolved before the plugin runs, and so the property that I'm trying to define is not available soon enough.
Here's the section of my POM:
<profiles>
<profile>
<id>dylink</id>
<dependencies>
<dependency>
<artifactId>outside-lib</artifactId>
<groupId>com.foo</groupId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${outsidelib.location}/outside-lib.jar</systemPath>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>C:\path\to\file.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
And I run something like mvn -P dylink compile
and get told that my systemPath
is invalid because it's not an absolute path. (The property contains an absolute path)
Alternatively, is there any other way I can do this? I need to be able to query the host system for the location of the system-scope dependency. It won't work to just hard-code the path into the POM.