mirror of https://github.com/apache/maven.git
fix issues found with a clean repo
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163754 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
27363f855e
commit
bab8d3fd90
|
@ -13,26 +13,26 @@
|
|||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.modello</groupId>
|
||||
<artifactId>modello</artifactId>
|
||||
<version>core-1.0-alpha-1</version>
|
||||
<artifactId>modello-core</artifactId>
|
||||
<version>1.0-alpha-1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.modello</groupId>
|
||||
<artifactId>modello</artifactId>
|
||||
<version>xdoc-plugin-1.0-alpha-1</version>
|
||||
<artifactId>modello-xdoc-plugin</artifactId>
|
||||
<version>1.0-alpha-1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.modello</groupId>
|
||||
<artifactId>modello</artifactId>
|
||||
<version>xml-plugin-1.0-alpha-1</version>
|
||||
<artifactId>modello-xml-plugin</artifactId>
|
||||
<version>1.0-alpha-1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.modello</groupId>
|
||||
<artifactId>modello</artifactId>
|
||||
<version>xpp3-plugin-1.0-alpha-1</version>
|
||||
<artifactId>modello-xpp3-plugin</artifactId>
|
||||
<version>1.0-alpha-1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
|
|
|
@ -254,21 +254,8 @@ public class MBoot
|
|||
}
|
||||
}
|
||||
|
||||
reader = new ModelReader( localRepository );
|
||||
|
||||
String basedir = System.getProperty( "user.dir" );
|
||||
|
||||
reader.parse( new File( basedir, "maven-mboot2/pom.xml" ) );
|
||||
|
||||
ClassLoader bootstrapClassLoader = createClassloaderFromDependencies( reader.getDependencies(), null,
|
||||
localRepository );
|
||||
|
||||
reader = new ModelReader( localRepository );
|
||||
reader.parse( new File( basedir, "maven-plugins/maven-surefire-plugin/pom.xml" ) );
|
||||
List surefireDependencies = reader.getDependencies();
|
||||
|
||||
reader = new ModelReader( localRepository );
|
||||
|
||||
// Install maven-components POM
|
||||
installPomFile( localRepository, new File( basedir, "pom.xml" ) );
|
||||
|
||||
|
@ -284,6 +271,19 @@ public class MBoot
|
|||
// Install it-support POM
|
||||
installPomFile( localRepository, new File( basedir, "maven-core-it-support/pom.xml" ) );
|
||||
|
||||
reader = new ModelReader( localRepository );
|
||||
|
||||
reader.parse( new File( basedir, "maven-mboot2/pom.xml" ) );
|
||||
|
||||
ClassLoader bootstrapClassLoader = createClassloaderFromDependencies( reader.getDependencies(), null,
|
||||
localRepository );
|
||||
|
||||
reader = new ModelReader( localRepository );
|
||||
reader.parse( new File( basedir, "maven-plugins/maven-surefire-plugin/pom.xml" ) );
|
||||
List surefireDependencies = reader.getDependencies();
|
||||
|
||||
reader = new ModelReader( localRepository );
|
||||
|
||||
List coreDeps = null;
|
||||
Dependency corePom = null;
|
||||
|
||||
|
@ -452,12 +452,7 @@ public class MBoot
|
|||
|
||||
ModelReader reader = new ModelReader( localRepository );
|
||||
|
||||
if ( !reader.parse( new File( basedir, "pom.xml" ) ) )
|
||||
{
|
||||
System.err.println( "Could not parse pom.xml" );
|
||||
|
||||
System.exit( 1 );
|
||||
}
|
||||
reader.parse( new File( basedir, "pom.xml" ) );
|
||||
|
||||
String sources = new File( basedir, SOURCES ).getAbsolutePath();
|
||||
|
||||
|
@ -711,12 +706,7 @@ public class MBoot
|
|||
{
|
||||
ModelReader reader = new ModelReader( localRepository );
|
||||
|
||||
if ( !reader.parse( pomIn ) )
|
||||
{
|
||||
System.err.println( "Could not parse pom.xml" );
|
||||
|
||||
System.exit( 1 );
|
||||
}
|
||||
reader.parse( pomIn );
|
||||
|
||||
installPomFile( reader, localRepository, pomIn );
|
||||
}
|
||||
|
|
|
@ -107,8 +107,10 @@ public class ArtifactDownloader
|
|||
|
||||
if ( repositories.isEmpty() )
|
||||
{
|
||||
// TODO: configure layout
|
||||
remoteRepos.add( new Repository( "http://repo1.maven.org", Repository.LAYOUT_LEGACY ) );
|
||||
// TODO: use super POM?
|
||||
Repository repository = new Repository();
|
||||
repository.setBasedir( "http://repo1.maven.org" );
|
||||
remoteRepos.add( repository );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,7 +124,7 @@ public class ArtifactDownloader
|
|||
|
||||
// The username and password parameters are not being
|
||||
// used here. Those are the "" parameters you see below.
|
||||
String url = remoteRepo.getArtifactPath( dep );
|
||||
String url = remoteRepo.getBasedir() + "/" + remoteRepo.getArtifactPath( dep );
|
||||
|
||||
if ( !url.startsWith( "file" ) )
|
||||
{
|
||||
|
|
|
@ -194,4 +194,9 @@ public class Dependency
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return getId() + ":" + getVersion() + ":" + getType();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@ import org.xml.sax.Attributes;
|
|||
import org.xml.sax.SAXException;
|
||||
import util.AbstractReader;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -169,9 +171,17 @@ public class ModelReader
|
|||
|
||||
ModelReader p = new ModelReader( localRepository );
|
||||
|
||||
if ( !p.parse( localRepository.getArtifactFile( parentGroupId, parentArtifactId, parentVersion, "pom" ) ) )
|
||||
try
|
||||
{
|
||||
throw new SAXException( "Could not parse parent pom.xml" );
|
||||
p.parse( localRepository.getArtifactFile( parentGroupId, parentArtifactId, parentVersion, "pom" ) );
|
||||
}
|
||||
catch ( ParserConfigurationException e )
|
||||
{
|
||||
throw new SAXException( "Error getting parent POM", e );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new SAXException( "Error getting parent POM", e );
|
||||
}
|
||||
|
||||
dependencies.addAll( p.getDependencies() );
|
||||
|
|
|
@ -26,10 +26,12 @@ import java.io.File;
|
|||
*/
|
||||
public class Repository
|
||||
{
|
||||
private String basedir;
|
||||
|
||||
public static final String LAYOUT_LEGACY = "legacy";
|
||||
|
||||
public static final String LAYOUT_DEFAULT = "default";
|
||||
|
||||
private String basedir;
|
||||
|
||||
private String layout = LAYOUT_LEGACY;
|
||||
|
||||
public Repository()
|
||||
|
@ -65,6 +67,12 @@ public class Repository
|
|||
repositoryPath = dependency.getArtifactDirectory() + "/" + dependency.getType() + "s/" +
|
||||
dependency.getArtifact();
|
||||
}
|
||||
else if ( LAYOUT_DEFAULT.equals( layout ) )
|
||||
{
|
||||
String pathGroup = dependency.getGroupId().replace( '.', '/' );
|
||||
repositoryPath = pathGroup + "/" + dependency.getArtifactId() + "/" + dependency.getVersion();
|
||||
repositoryPath = repositoryPath + "/" + dependency.getArtifact();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IllegalStateException( "Unknown layout: " + layout );
|
||||
|
@ -74,12 +82,18 @@ public class Repository
|
|||
|
||||
public File getMetadataFile( String groupId, String artifactId, String version, String type, String filename )
|
||||
{
|
||||
Dependency d = new Dependency( groupId, artifactId, version, type );
|
||||
Dependency dependency = new Dependency( groupId, artifactId, version, type );
|
||||
|
||||
String repositoryPath;
|
||||
if ( LAYOUT_LEGACY.equals( layout ) )
|
||||
{
|
||||
repositoryPath = d.getArtifactDirectory() + "/poms/" + filename;
|
||||
repositoryPath = dependency.getArtifactDirectory() + "/poms/" + filename;
|
||||
}
|
||||
else if ( LAYOUT_DEFAULT.equals( layout ) )
|
||||
{
|
||||
String pathGroup = dependency.getGroupId().replace( '.', '/' );
|
||||
repositoryPath = pathGroup + "/" + dependency.getArtifactId() + "/" + dependency.getVersion();
|
||||
repositoryPath = repositoryPath + "/" + filename;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -17,13 +17,16 @@ package util;
|
|||
*/
|
||||
|
||||
import org.xml.sax.InputSource;
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXParseException;
|
||||
import org.xml.sax.helpers.DefaultHandler;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Parse an XML file.
|
||||
|
@ -35,9 +38,8 @@ public abstract class AbstractReader
|
|||
{
|
||||
private SAXParserFactory saxFactory;
|
||||
|
||||
public boolean parse( File file )
|
||||
{
|
||||
try
|
||||
public void parse( File file )
|
||||
throws ParserConfigurationException, SAXException, IOException
|
||||
{
|
||||
saxFactory = SAXParserFactory.newInstance();
|
||||
|
||||
|
@ -46,15 +48,6 @@ public abstract class AbstractReader
|
|||
InputSource is = new InputSource( new FileInputStream( file ) );
|
||||
|
||||
parser.parse( is, this );
|
||||
|
||||
return true;
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
e.printStackTrace();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void warning( SAXParseException spe )
|
||||
|
|
Loading…
Reference in New Issue