blob: 36a2086da85af3df908872debca490cd7a40752b [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.io.*;
import java.util.*;
import java.util.regex.*;
import org.codehaus.plexus.util.*;
boolean checkValue( String expected, String key, Properties props )
{
String actual = props.getProperty( key );
if ( !expected.equals( actual ) )
{
System.err.println( "Generated build properties contain bad value for key " + key + ": expected \"" + expected
+ "\" but was \"" + actual + "\"" );
return false;
}
return true;
}
try
{
File propsFile = new File( basedir, "maven-build.properties" );
Properties props = new Properties();
InputStream in = null;
try
{
in = new FileInputStream( propsFile );
props.load( in );
}
finally
{
IOUtil.close( in );
}
if ( !checkValue( "target", "maven.build.dir", props ) )
{
return false;
}
if ( !checkValue( "src/main/java", "maven.build.srcDir.0", props ) )
{
return false;
}
if ( !checkValue( "src/test/java", "maven.build.testDir.0", props ) )
{
return false;
}
if ( !checkValue( "src/main/resources", "maven.build.resourceDir.0", props ) )
{
return false;
}
if ( !checkValue( ".", "maven.build.resourceDir.1", props ) )
{
return false;
}
}
catch( Throwable t )
{
t.printStackTrace();
return false;
}
return true;