multi-project-wide maven-filtering with validation-break

Imagine, you want to provide properties-files for all your projects and enable a project-filtering with them.
As an example I created a project called properties-project, that will be separately deployed to repo and will be fetched by a component-project that unpacks the properties and uses them to filter its own config-files.
After filtering there comes a validation-check that there are no unfiltered properties anymore in the config-file.
If the check fails, the maven-build will also break.

the properties-project with its properties:

<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>eu.christophburmeister</groupId>
	<artifactId>properties-project</artifactId>
	<version>0.1-SNAPSHOT</version>
</project>
remote.server.url = http://13.13.13.13:13131
remote.server.url = http://10.33.127.9:12345
remote.server.url = http://127.0.0.1:12345

simply deploy this via „mvn clean deploy“ to make it available in the repo for other components.

And the component-project with its config.xml that will be filtered

<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>eu.christophburmeister</groupId>
	<artifactId>component</artifactId>
	<version>0.1-SNAPSHOT</version>

	<properties>
		<env>development</env>
		<imported.properties.path>${project.basedir}/target/imported-properties/</imported.properties.path>
	</properties>

	<build>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
				<includes>
					<include>config.xml</include>
				</includes>
			</resource>
		</resources>
		<filters>
			<filter>${imported.properties.path}/${env}.properties</filter>
		</filters>
		<plugins>
			<plugin>
				<artifactId>maven-antrun-plugin</artifactId>
				<version>1.7</version>
				<executions>
					<execution>
						<phase>test</phase>
						<configuration>
							<target>
								<loadfile property="config-content" srcfile="${project.basedir}/target/classes/config.xml" />
								<echo message="the filtered config.xml:" />
								<echo message="${config-content}" />
								<!-- check for unfiltered expressions -->
								<condition property="config-unused-expression"> 
									<matches pattern=".*\{.*" string="${config-content}"/>
								</condition>
								<fail message="Sorry, I found an expression in your config that couldn't be found in the properties-project. Please check your config.xml ."  if="${config-unused-expression}" />
							</target>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>2.8</version>
				<executions>
					<execution>
						<id>unpack</id>
						<phase>generate-resources</phase>
						<goals>
							<goal>unpack</goal>
						</goals>
						<configuration>
							<artifactItems>
								<artifactItem>
									<groupId>eu.christophburmeister</groupId>
									<artifactId>properties-project</artifactId>
									<type>jar</type>
									<outputDirectory>${imported.properties.path}</outputDirectory>
								</artifactItem>
							</artifactItems>
							<overWriteReleases>true</overWriteReleases>
							<overWriteSnapshots>true</overWriteSnapshots>
						</configuration>
					</execution>
				</executions>
			</plugin>

		</plugins>
	</build>

	<dependencies>
		<dependency>
			<groupId>eu.christophburmeister</groupId>
			<artifactId>properties-project</artifactId>
			<version>0.1-SNAPSHOT</version>
		</dependency>
	</dependencies>
</project>
remote.server.url = ${remote.server.url}
remote.server.url = ${remote.server.url}
timeout = ${timeout}

The second config.xml will break the build because the ${timeout} is not filterable with the given properties from properties-project.

C:\tmp\component>mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building component 0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ component ---
[INFO] Deleting C:\tmp\component\target
[INFO]
[INFO] --- maven-dependency-plugin:2.8:unpack (unpack) @ component ---
[INFO] Configured Artifact: eu.christophburmeister:project-properties:?:jar
[INFO] Unpacking D:\apache-maven-3.1.1-repo\eu\christophburmeister\project-propertie
s\0.1-SNAPSHOT\project-properties-0.1-SNAPSHOT.jar to C:\tmp\component\target\imported-pro
perties with includes "" and excludes ""
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ component ---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform depende
nt!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ component ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ component ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform depende
nt!
[INFO] skip non existing resourceDirectory C:\tmp\component\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ component ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ component ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-antrun-plugin:1.7:run (default) @ component ---
[INFO] Executing tasks

main:
     [echo] the filtered config.xml:
     [echo] remote.server.url = http://127.0.0.1:12345
     [echo] timeout = ${timeout}
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.740s
[INFO] Finished at: Sun Feb 16 11:19:25 CET 2014
[INFO] Final Memory: 9M/24M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (default) on project compo
nent: An Ant BuildException has occured: Sorry, I found an expression in your config that couldn't be found in
 the properties-project. Please check your config.xml .
[ERROR] around Ant part ...<fail message="Sorry, I found an expression in your config that couldn&apos;t be fo
und in the properties-project. Please check your config.xml ." if="${config-unused-expression}"/>... @ 10:183
in C:\tmp\component\target\antrun\build-main.xml
[ERROR] -> [Help 1]
[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/MojoExecutionException