From fa4aa397259b5e9a4037c71bdc490d7fb97ec529 Mon Sep 17 00:00:00 2001 From: Brett Porter Date: Tue, 8 Apr 2008 01:24:10 +0000 Subject: a couple of workarounds to force "offline" behaviour git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@645751 13f79535-47bb-0310-9956-ffa450edef68 --- archiva-cli/pom.xml | 5 +++ .../org/apache/maven/archiva/cli/ArchivaCli.java | 38 ++++++++++++---------- 2 files changed, 26 insertions(+), 17 deletions(-) (limited to 'archiva-cli') diff --git a/archiva-cli/pom.xml b/archiva-cli/pom.xml index f2101ed79..ed18c9112 100644 --- a/archiva-cli/pom.xml +++ b/archiva-cli/pom.xml @@ -47,6 +47,11 @@ org.apache.archiva archiva-converter + + org.apache.maven.wagon + wagon-file + 1.0-beta-2 + com.google.code.cli-parser cli diff --git a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java index c2e98049e..4462dbcb2 100644 --- a/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java +++ b/archiva-cli/src/main/java/org/apache/maven/archiva/cli/ArchivaCli.java @@ -19,8 +19,19 @@ package org.apache.maven.archiva.cli; * under the License. */ +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.net.MalformedURLException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Properties; + import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.consumers.ConsumerException; import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer; @@ -31,26 +42,13 @@ import org.apache.maven.archiva.converter.legacy.LegacyRepositoryConverter; import org.apache.maven.archiva.repository.RepositoryException; import org.apache.maven.archiva.repository.scanner.RepositoryScanStatistics; import org.apache.maven.archiva.repository.scanner.RepositoryScanner; +import org.apache.maven.artifact.manager.WagonManager; import org.codehaus.plexus.spring.PlexusClassPathXmlApplicationContext; import org.codehaus.plexus.spring.PlexusToSpringUtils; import com.sampullara.cli.Args; import com.sampullara.cli.Argument; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Properties; - /** * ArchivaCli * @@ -144,8 +142,14 @@ public class ArchivaCli } private void doScan( String path, String[] consumers ) - throws ConsumerException + throws ConsumerException, MalformedURLException { + // hack around poorly configurable project builder by pointing all repositories back at this location to be self + // contained + WagonManager wagonManager = + (WagonManager) applicationContext.getBean( PlexusToSpringUtils.buildSpringId( WagonManager.class.getName() ) ); + wagonManager.addMirror( "internal", "*", new File( path ).toURL().toExternalForm() ); + ManagedRepositoryConfiguration repo = new ManagedRepositoryConfiguration(); repo.setId( "cliRepo" ); repo.setName( "Archiva CLI Provided Repo" ); @@ -218,7 +222,7 @@ public class ArchivaCli } } - @SuppressWarnings("unchecked") + @SuppressWarnings( "unchecked" ) private Map getConsumers() { return PlexusToSpringUtils.lookupMap( "knownRepositoryContentConsumer", applicationContext ); -- cgit v1.2.3