验证您的 changes.xml 文件

从 2.1 开始,提供了一个目标来验证您的changes.xml文件。

如果您希望在生成站点时自动执行验证,您可以将此目标附加到站点前阶段。

配置插件

首先,您必须配置插件并告诉它验证您的changes.xml文件。

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-changes-plugin</artifactId>
        <version>2.8</version>
        <executions>
          <execution>
            <id>validate-changes</id>
            <phase>pre-site</phase>
            <goals>
              <goal>changes-validate</goal>
            </goals>
            <configuration>
              <!-- if set to true the build will fail if the changes file is invalid,
                   if set to false warnings will be logged. -->
              <failOnError>true</failOnError>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  ...
</project>