Index: maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PropertyInterpolationVerifierMojo.java =================================================================== --- maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PropertyInterpolationVerifierMojo.java (revision 0) +++ maven-it-plugin-project-interpolation/src/main/java/org/apache/maven/plugin/coreit/PropertyInterpolationVerifierMojo.java (revision 0) @@ -0,0 +1,58 @@ +package org.apache.maven.plugin.coreit; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.project.MavenProject; +import org.apache.maven.model.Model; + +import java.io.File; +import java.util.Properties; +import java.util.Iterator; +import java.util.Map; +import java.util.Enumeration; + +/** + * @goal verify-property + * @phase validate + */ +public class PropertyInterpolationVerifierMojo extends AbstractMojo { + + /** + * @parameter expression="${project}" + */ + private MavenProject project; + + /** + * @parameter expression="${buildSourceDirectory}" + */ + private File buildSourceDirectory; + + /** + * @parameter expression="${properties}" + */ + private Properties properties; + + + public void execute() throws MojoExecutionException, MojoFailureException { + Model model = project.getModel(); + if (properties == null) { + return; + } + + Enumeration e = properties.propertyNames(); + while (e.hasMoreElements()) { + String name = (String) e.nextElement(); + String value = properties.getProperty(name); + if(!value.equals(model.getProperties().getProperty(name))) { + throw new MojoExecutionException("Properties do not match: Name = " + name + ", Value = " + value); + } + else if(value.contains("${")) { + throw new MojoExecutionException("Unresolved value: Name = " + name + ", Value = " + value); + } + else { + getLog().info("Property match: Name = " + name + ", Value = " + value); + } + } + } +}