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>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.modello</groupId>
|
<groupId>org.codehaus.modello</groupId>
|
||||||
<artifactId>modello</artifactId>
|
<artifactId>modello-core</artifactId>
|
||||||
<version>core-1.0-alpha-1</version>
|
<version>1.0-alpha-1</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.modello</groupId>
|
<groupId>org.codehaus.modello</groupId>
|
||||||
<artifactId>modello</artifactId>
|
<artifactId>modello-xdoc-plugin</artifactId>
|
||||||
<version>xdoc-plugin-1.0-alpha-1</version>
|
<version>1.0-alpha-1</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.modello</groupId>
|
<groupId>org.codehaus.modello</groupId>
|
||||||
<artifactId>modello</artifactId>
|
<artifactId>modello-xml-plugin</artifactId>
|
||||||
<version>xml-plugin-1.0-alpha-1</version>
|
<version>1.0-alpha-1</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.modello</groupId>
|
<groupId>org.codehaus.modello</groupId>
|
||||||
<artifactId>modello</artifactId>
|
<artifactId>modello-xpp3-plugin</artifactId>
|
||||||
<version>xpp3-plugin-1.0-alpha-1</version>
|
<version>1.0-alpha-1</version>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
|
@ -254,21 +254,8 @@ public class MBoot
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reader = new ModelReader( localRepository );
|
|
||||||
|
|
||||||
String basedir = System.getProperty( "user.dir" );
|
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
|
// Install maven-components POM
|
||||||
installPomFile( localRepository, new File( basedir, "pom.xml" ) );
|
installPomFile( localRepository, new File( basedir, "pom.xml" ) );
|
||||||
|
|
||||||
|
@ -284,6 +271,19 @@ public class MBoot
|
||||||
// Install it-support POM
|
// Install it-support POM
|
||||||
installPomFile( localRepository, new File( basedir, "maven-core-it-support/pom.xml" ) );
|
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;
|
List coreDeps = null;
|
||||||
Dependency corePom = null;
|
Dependency corePom = null;
|
||||||
|
|
||||||
|
@ -452,12 +452,7 @@ public class MBoot
|
||||||
|
|
||||||
ModelReader reader = new ModelReader( localRepository );
|
ModelReader reader = new ModelReader( localRepository );
|
||||||
|
|
||||||
if ( !reader.parse( new File( basedir, "pom.xml" ) ) )
|
reader.parse( new File( basedir, "pom.xml" ) );
|
||||||
{
|
|
||||||
System.err.println( "Could not parse pom.xml" );
|
|
||||||
|
|
||||||
System.exit( 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
String sources = new File( basedir, SOURCES ).getAbsolutePath();
|
String sources = new File( basedir, SOURCES ).getAbsolutePath();
|
||||||
|
|
||||||
|
@ -711,12 +706,7 @@ public class MBoot
|
||||||
{
|
{
|
||||||
ModelReader reader = new ModelReader( localRepository );
|
ModelReader reader = new ModelReader( localRepository );
|
||||||
|
|
||||||
if ( !reader.parse( pomIn ) )
|
reader.parse( pomIn );
|
||||||
{
|
|
||||||
System.err.println( "Could not parse pom.xml" );
|
|
||||||
|
|
||||||
System.exit( 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
installPomFile( reader, localRepository, pomIn );
|
installPomFile( reader, localRepository, pomIn );
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,8 +107,10 @@ public class ArtifactDownloader
|
||||||
|
|
||||||
if ( repositories.isEmpty() )
|
if ( repositories.isEmpty() )
|
||||||
{
|
{
|
||||||
// TODO: configure layout
|
// TODO: use super POM?
|
||||||
remoteRepos.add( new Repository( "http://repo1.maven.org", Repository.LAYOUT_LEGACY ) );
|
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
|
// The username and password parameters are not being
|
||||||
// used here. Those are the "" parameters you see below.
|
// 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" ) )
|
if ( !url.startsWith( "file" ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -194,4 +194,9 @@ public class Dependency
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return getId() + ":" + getVersion() + ":" + getType();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,8 @@ import org.xml.sax.Attributes;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
import util.AbstractReader;
|
import util.AbstractReader;
|
||||||
|
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -169,9 +171,17 @@ public class ModelReader
|
||||||
|
|
||||||
ModelReader p = new ModelReader( localRepository );
|
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() );
|
dependencies.addAll( p.getDependencies() );
|
||||||
|
|
|
@ -26,10 +26,12 @@ import java.io.File;
|
||||||
*/
|
*/
|
||||||
public class Repository
|
public class Repository
|
||||||
{
|
{
|
||||||
private String basedir;
|
|
||||||
|
|
||||||
public static final String LAYOUT_LEGACY = "legacy";
|
public static final String LAYOUT_LEGACY = "legacy";
|
||||||
|
|
||||||
|
public static final String LAYOUT_DEFAULT = "default";
|
||||||
|
|
||||||
|
private String basedir;
|
||||||
|
|
||||||
private String layout = LAYOUT_LEGACY;
|
private String layout = LAYOUT_LEGACY;
|
||||||
|
|
||||||
public Repository()
|
public Repository()
|
||||||
|
@ -65,6 +67,12 @@ public class Repository
|
||||||
repositoryPath = dependency.getArtifactDirectory() + "/" + dependency.getType() + "s/" +
|
repositoryPath = dependency.getArtifactDirectory() + "/" + dependency.getType() + "s/" +
|
||||||
dependency.getArtifact();
|
dependency.getArtifact();
|
||||||
}
|
}
|
||||||
|
else if ( LAYOUT_DEFAULT.equals( layout ) )
|
||||||
|
{
|
||||||
|
String pathGroup = dependency.getGroupId().replace( '.', '/' );
|
||||||
|
repositoryPath = pathGroup + "/" + dependency.getArtifactId() + "/" + dependency.getVersion();
|
||||||
|
repositoryPath = repositoryPath + "/" + dependency.getArtifact();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new IllegalStateException( "Unknown layout: " + layout );
|
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 )
|
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;
|
String repositoryPath;
|
||||||
if ( LAYOUT_LEGACY.equals( layout ) )
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,13 +17,16 @@ package util;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.SAXParseException;
|
import org.xml.sax.SAXParseException;
|
||||||
import org.xml.sax.helpers.DefaultHandler;
|
import org.xml.sax.helpers.DefaultHandler;
|
||||||
|
|
||||||
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
import javax.xml.parsers.SAXParser;
|
import javax.xml.parsers.SAXParser;
|
||||||
import javax.xml.parsers.SAXParserFactory;
|
import javax.xml.parsers.SAXParserFactory;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse an XML file.
|
* Parse an XML file.
|
||||||
|
@ -35,26 +38,16 @@ public abstract class AbstractReader
|
||||||
{
|
{
|
||||||
private SAXParserFactory saxFactory;
|
private SAXParserFactory saxFactory;
|
||||||
|
|
||||||
public boolean parse( File file )
|
public void parse( File file )
|
||||||
|
throws ParserConfigurationException, SAXException, IOException
|
||||||
{
|
{
|
||||||
try
|
saxFactory = SAXParserFactory.newInstance();
|
||||||
{
|
|
||||||
saxFactory = SAXParserFactory.newInstance();
|
|
||||||
|
|
||||||
SAXParser parser = saxFactory.newSAXParser();
|
SAXParser parser = saxFactory.newSAXParser();
|
||||||
|
|
||||||
InputSource is = new InputSource( new FileInputStream( file ) );
|
InputSource is = new InputSource( new FileInputStream( file ) );
|
||||||
|
|
||||||
parser.parse( is, this );
|
parser.parse( is, this );
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch ( Exception e )
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void warning( SAXParseException spe )
|
public void warning( SAXParseException spe )
|
||||||
|
|
Loading…
Reference in New Issue