Как обеспечить, чтобы было установлено свойство, указывающее на базовый каталог для systemPath?
Я пытаюсь принудительно установить, что свойство установлено с помощью плагина mavenforcecer. Свойство должно указывать на каталог и использоваться в качестве базового каталога для некоторых зависимостей области системы. У меня есть следующее pom.xml
:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>maven-enforcer-systempath</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.example</groupId>
<artifactId>bar</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${non.existent.property}/bar.jar</systemPath>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
<executions>
<execution>
<id>enforce-property</id>
<goals>
<goal>enforce</goal>
</goals>
<phase>validate</phase>
<configuration>
<rules>
<requireProperty>
<property>non.existent.property</property>
<message>"non.existent.property" must point to a directory</message>
</requireProperty>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Теперь, когда я запускаю проект со свойством non.existent.property
не устанавливается, я получаю следующий вывод:
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] 'dependencies.dependency.systemPath' for org.example:bar:jar must specify an absolute path but is ${non.existent.property}/bar.jar @ line 14, column 16
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project org.example:maven-enforcer-systempath:0.0.1-SNAPSHOT (C:\Users\workingcopy\maven-enforcer-systempath\pom.xml) has 1 error
[ERROR] 'dependencies.dependency.systemPath' for org.example:bar:jar must specify an absolute path but is ${non.existent.property}/bar.jar @ line 14, column 16
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
Обнаруженная ошибка появляется до того, как подключается плагин принудительного применения. Я полагаю, что это потому, что документация о принудительной цели гласит:
Требует сбора зависимостей артефактов в области действия: тест.
Как я могу обеспечить, чтобы свойство было установлено до сбора зависимостей?