diff --git a/maven-mboot2/src/main/java/MBoot.java b/maven-mboot2/src/main/java/MBoot.java index 25dbdeb5f8..a48b473ead 100644 --- a/maven-mboot2/src/main/java/MBoot.java +++ b/maven-mboot2/src/main/java/MBoot.java @@ -819,6 +819,11 @@ public class MBoot metadata.setReleaseVersion( version ); file = localRepository.getMetadataFile( groupId, artifactId, null, type, "maven-metadata-local.xml" ); 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, diff --git a/maven-mboot2/src/main/java/download/ArtifactDownloader.java b/maven-mboot2/src/main/java/download/ArtifactDownloader.java index accafa7582..6151985816 100644 --- a/maven-mboot2/src/main/java/download/ArtifactDownloader.java +++ b/maven-mboot2/src/main/java/download/ArtifactDownloader.java @@ -75,14 +75,14 @@ public class ArtifactDownloader // not exists so create it if missing. File directory = destinationFile.getParentFile(); - if ( directory.exists() == false ) + if ( !directory.exists() ) { directory.mkdirs(); } boolean snapshot = isSnapshot( dep ); - if ( dep.getGroupId().equals( "org.apache.maven" ) && snapshot ) + if ( "org.apache.maven".equals( dep.getGroupId() ) && snapshot ) { //skip our own continue; @@ -143,7 +143,8 @@ public class ArtifactDownloader File remoteFile = localRepository.getMetadataFile( dep.getGroupId(), dep.getArtifactId(), dep.getVersion(), dep.getType(), filename ); 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; log( "Downloading " + metaUrl ); try diff --git a/maven-mboot2/src/main/java/download/RepositoryMetadata.java b/maven-mboot2/src/main/java/download/RepositoryMetadata.java index 2613626a27..71c354f7de 100644 --- a/maven-mboot2/src/main/java/download/RepositoryMetadata.java +++ b/maven-mboot2/src/main/java/download/RepositoryMetadata.java @@ -31,7 +31,7 @@ import java.util.Iterator; import java.util.List; /** - * TODO: describe + * I/O for repository metadata. * * @author Brett Porter * @version $Id$ @@ -54,6 +54,8 @@ public class RepositoryMetadata private String latestVersion; + private boolean localCopy; + public String getSnapshotTimestamp() { return snapshotTimestamp; @@ -139,6 +141,16 @@ public class RepositoryMetadata versions.add( version ); } + public boolean isLocalCopy() + { + return localCopy; + } + + public void setLocalCopy( boolean localCopy ) + { + this.localCopy = localCopy; + } + public static RepositoryMetadata read( File file ) throws IOException, ParserConfigurationException, SAXException { @@ -194,6 +206,10 @@ public class RepositoryMetadata { metadata.setSnapshotTimestamp( getBodyText() ); } + else if ( "localCopy".equals( rawName ) ) + { + metadata.setLocalCopy( Boolean.valueOf( getBodyText() ).booleanValue() ); + } } else if ( insideVersions ) { @@ -301,6 +317,7 @@ public class RepositoryMetadata writeLine( w, " ", "latest", metadata.getLatestVersion() ); writeLine( w, " ", "release", metadata.getReleaseVersion() ); w.println( " " ); + writeLine( w, " ", "localCopy", String.valueOf( metadata.isLocalCopy() ) ); writeLine( w, " ", "buildNumber", String.valueOf( metadata.getSnapshotBuildNumber() ) ); writeLine( w, " ", "timestamp", metadata.getSnapshotTimestamp() ); w.println( " " );