o Rolling back changes to super-model loading, with the exception of the supermodel file name change...it's still changed to pom-4.0.0.xml

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163088 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2004-09-16 18:06:01 +00:00
parent 2d4e9a1a0e
commit 30e1d1f23f
1 changed files with 3 additions and 50 deletions

View File

@ -16,7 +16,6 @@ package org.apache.maven.project;
* limitations under the License.
*/
import org.apache.maven.Maven;
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.DefaultArtifact;
import org.apache.maven.artifact.MavenMetadataSource;
@ -102,6 +101,9 @@ public class DefaultMavenProjectBuilder
try
{
// TODO: rename to super-pom.xml so it is not used by the reactor
superModel = modelReader.read( new InputStreamReader( DefaultMavenProjectBuilder.class.getResourceAsStream( "pom-4.0.0.xml" ) ) );
Model userModel = null;
// TODO: use maven home local instead of user.home/.m2
File userModelFile = new File( System.getProperty( "user.home" ) + "/.m2", "override.xml" );
@ -117,23 +119,8 @@ public class DefaultMavenProjectBuilder
{
localRepositoryValue = userModel.getLocal().getRepository();
}
validateLeafModel(userModel);
// TODO: rename to super-pom.xml so it is not used by the reactor
superModel = modelReader.read( new InputStreamReader( DefaultMavenProjectBuilder.class.getResourceAsStream( "pom-4.0.0.xml" ) ) );
// [JDC 9/16]: Commented until I have time to figure this out...
// badmodelVersion somewhere
//superModel = modelReader.read( new InputStreamReader( DefaultMavenProjectBuilder.class.getResourceAsStream( "pom-" + userModel.getModelVersion() + ".xml" ) ) );
superModel.getRepositories().addAll( userModel.getRepositories() );
}
if(superModel == null)
{
superModel = modelReader.read( new InputStreamReader( DefaultMavenProjectBuilder.class.getResourceAsStream( "pom-" + Maven.DEFAULT_MODEL_VERSION + ".xml" ) ) );
}
if ( localRepositoryValue == null && superModel.getLocal() != null && superModel.getLocal().getRepository() != null )
{
@ -231,40 +218,6 @@ public class DefaultMavenProjectBuilder
}
}
private void validateLeafModel( Model userModel )
{
// [JDC 9/16]:
// Commenting this out until I have time to get this particular validation
// fixed in all tests, core plugins, and IT's...
/*
String modelVersion = userModel.getModelVersion();
if ( modelVersion == null || modelVersion.length() < 1 )
{
throw new IllegalStateException( "POM element \'modelVersion\' must be specified; it may not be inherited" );
}
String name = userModel.getName();
if ( name == null || name.length() < 1 )
{
throw new IllegalStateException( "POM element \'name\' must be specified; it may not be inherited" );
}
String artifactId = userModel.getArtifactId();
if ( artifactId == null || artifactId.length() < 1 )
{
throw new IllegalStateException( "POM element \'artifactId\' must be specified; it may not be inherited" );
}
String version = userModel.getVersion();
if ( version == null || version.length() < 1 )
{
throw new IllegalStateException( "POM element \'version\' must be specified; it may not be inherited" );
}
*/
}
private MavenProject assembleLineage( File projectDescriptor,
ArtifactRepository localRepository,
LinkedList lineage,