public ArchivaProjectModel read( File pomFile )
throws ProjectModelException
{
try
{
XMLReader xml = new XMLReader( "project", pomFile );
ArchivaProjectModel model = new ArchivaProjectModel();
if ( !"http://maven.apache.org/POM/4.0.0".equals( xml.getDefaultNamespaceURI() ) )
{
// TODO: Output to monitor the problem with the Namespace.
System.out.println( "No namespace defined: " + pomFile );
}
xml.removeNamespaces();
Element project = xml.getElement( "//project" );
model.setGroupId( project.elementTextTrim( "groupId" ) );
model.setArtifactId( project.elementTextTrim( "artifactId" ) );
model.setVersion( project.elementTextTrim( "version" ) );
model.setName( project.elementTextTrim( "name" ) );
model.setDescription( project.elementTextTrim( "description" ) );
model.setUrl( project.elementTextTrim( "url" ) );
model.setPackaging( StringUtils.defaultIfEmpty( project.elementTextTrim( "packaging" ), "jar" ) );
model.setParentProject( getParentProject( xml ) );
model.setMailingLists( getMailingLists( xml ) );
model.setCiManagement( getCiManagement( xml ) );
model.setIndividuals( getIndividuals( xml ) );
model.setIssueManagement( getIssueManagement( xml ) );
model.setLicenses( getLicenses( xml ) );
model.setOrganization( getOrganization( xml ) );
model.setScm( getSCM( xml ) );
model.setRepositories( getRepositories( xml ) );
model.setDependencies( getDependencies( xml ) );
model.setDependencyManagement( getDependencyManagement( xml ) );
model.setPlugins( getPlugins( xml ) );
model.setReports( getReports( xml ) );
model.setProperties( getProperties( xml.getElement( "//project/properties" ) ) );
model.setBuildExtensions( getBuildExtensions( xml ) );
return model;
}