handle flag in mboot

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@280235 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-09-12 01:54:55 +00:00
parent ba1cb58030
commit ba88f96118
3 changed files with 27 additions and 4 deletions

View File

@ -819,6 +819,11 @@ public class MBoot
metadata.setReleaseVersion( version ); metadata.setReleaseVersion( version );
file = localRepository.getMetadataFile( groupId, artifactId, null, type, "maven-metadata-local.xml" ); file = localRepository.getMetadataFile( groupId, artifactId, null, type, "maven-metadata-local.xml" );
metadata.write( file ); metadata.write( file );
metadata = new RepositoryMetadata();
metadata.setLocalCopy( true );
file = localRepository.getMetadataFile( groupId, artifactId, version, type, "maven-metadata-local.xml" );
metadata.write( file );
} }
private void runTests( String basedir, String classes, String testClasses, ModelReader reader, private void runTests( String basedir, String classes, String testClasses, ModelReader reader,

View File

@ -75,14 +75,14 @@ public class ArtifactDownloader
// not exists so create it if missing. // not exists so create it if missing.
File directory = destinationFile.getParentFile(); File directory = destinationFile.getParentFile();
if ( directory.exists() == false ) if ( !directory.exists() )
{ {
directory.mkdirs(); directory.mkdirs();
} }
boolean snapshot = isSnapshot( dep ); boolean snapshot = isSnapshot( dep );
if ( dep.getGroupId().equals( "org.apache.maven" ) && snapshot ) if ( "org.apache.maven".equals( dep.getGroupId() ) && snapshot )
{ {
//skip our own //skip our own
continue; continue;
@ -143,7 +143,8 @@ public class ArtifactDownloader
File remoteFile = localRepository.getMetadataFile( dep.getGroupId(), dep.getArtifactId(), File remoteFile = localRepository.getMetadataFile( dep.getGroupId(), dep.getArtifactId(),
dep.getVersion(), dep.getType(), filename ); dep.getVersion(), dep.getType(), filename );
String metadataPath = remoteRepo.getMetadataPath( dep.getGroupId(), dep.getArtifactId(), String metadataPath = remoteRepo.getMetadataPath( dep.getGroupId(), dep.getArtifactId(),
dep.getVersion(), dep.getType(), "maven-metadata.xml" ); dep.getVersion(), dep.getType(),
"maven-metadata.xml" );
String metaUrl = remoteRepo.getBasedir() + "/" + metadataPath; String metaUrl = remoteRepo.getBasedir() + "/" + metadataPath;
log( "Downloading " + metaUrl ); log( "Downloading " + metaUrl );
try try

View File

@ -31,7 +31,7 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
/** /**
* TODO: describe * I/O for repository metadata.
* *
* @author <a href="mailto:brett@apache.org">Brett Porter</a> * @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$ * @version $Id$
@ -54,6 +54,8 @@ public class RepositoryMetadata
private String latestVersion; private String latestVersion;
private boolean localCopy;
public String getSnapshotTimestamp() public String getSnapshotTimestamp()
{ {
return snapshotTimestamp; return snapshotTimestamp;
@ -139,6 +141,16 @@ public class RepositoryMetadata
versions.add( version ); versions.add( version );
} }
public boolean isLocalCopy()
{
return localCopy;
}
public void setLocalCopy( boolean localCopy )
{
this.localCopy = localCopy;
}
public static RepositoryMetadata read( File file ) public static RepositoryMetadata read( File file )
throws IOException, ParserConfigurationException, SAXException throws IOException, ParserConfigurationException, SAXException
{ {
@ -194,6 +206,10 @@ public class RepositoryMetadata
{ {
metadata.setSnapshotTimestamp( getBodyText() ); metadata.setSnapshotTimestamp( getBodyText() );
} }
else if ( "localCopy".equals( rawName ) )
{
metadata.setLocalCopy( Boolean.valueOf( getBodyText() ).booleanValue() );
}
} }
else if ( insideVersions ) else if ( insideVersions )
{ {
@ -301,6 +317,7 @@ public class RepositoryMetadata
writeLine( w, " ", "latest", metadata.getLatestVersion() ); writeLine( w, " ", "latest", metadata.getLatestVersion() );
writeLine( w, " ", "release", metadata.getReleaseVersion() ); writeLine( w, " ", "release", metadata.getReleaseVersion() );
w.println( " <snapshot>" ); w.println( " <snapshot>" );
writeLine( w, " ", "localCopy", String.valueOf( metadata.isLocalCopy() ) );
writeLine( w, " ", "buildNumber", String.valueOf( metadata.getSnapshotBuildNumber() ) ); writeLine( w, " ", "buildNumber", String.valueOf( metadata.getSnapshotBuildNumber() ) );
writeLine( w, " ", "timestamp", metadata.getSnapshotTimestamp() ); writeLine( w, " ", "timestamp", metadata.getSnapshotTimestamp() );
w.println( " </snapshot>" ); w.println( " </snapshot>" );