brett 2005/04/03 23:47:21
Modified: maven-core/src/main/java/org/apache/maven/cli MavenCli.java maven-core-it-verifier/src/main/java/org/apache/maven/it Verifier.java maven-mboot2/src/main/java/download ArtifactDownloader.java maven-mboot2/src/main/java/model Repository.java maven-mboot2/src/main/java MBoot.java Log: make m2 use the local repository in the new layout Revision Changes Path 1.27 +2 -26 maven-components/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java Index: MavenCli.java =================================================================== RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- MavenCli.java 4 Apr 2005 03:48:01 -0000 1.26 +++ MavenCli.java 4 Apr 2005 06:47:21 -0000 1.27 @@ -149,22 +149,8 @@ artifactRepositoryFactory.setGlobalSnapshotPolicy( ArtifactRepository.SNAPSHOT_POLICY_ALWAYS ); } - // TODO: Switch the default repository layout id to "default" when the - // conversion is done. - String repoLayoutId = "legacy"; - - if ( commandLine.hasOption( CLIManager.VERSION_1_REPO ) ) - { - repoLayoutId = "legacy"; - } - - if ( commandLine.hasOption( CLIManager.VERSION_2_REPO ) ) - { - repoLayoutId = "default"; - } - ArtifactRepositoryLayout repositoryLayout = (ArtifactRepositoryLayout) embedder.lookup( - ArtifactRepositoryLayout.ROLE, repoLayoutId ); + ArtifactRepositoryLayout.ROLE, "default" ); ArtifactRepository localRepository = getLocalRepository( settings, artifactRepositoryFactory, repositoryLayout ); @@ -306,11 +292,6 @@ public static final char NON_RECURSIVE = 'N'; - public static final char VERSION_1_REPO = 'A'; - - // TODO: this is a hack until we can get the main repo converted... - public static final char VERSION_2_REPO = 'a'; - public static final char UPDATE_SNAPSHOTS = 'U'; public CLIManager() @@ -334,11 +315,6 @@ "Execute goals for project found in the reactor" ).create( REACTOR ) ); options.addOption( OptionBuilder.withLongOpt( "non-recursive" ).withDescription( "Do not recurse into sub-projects" ).create( NON_RECURSIVE ) ); - options.addOption( OptionBuilder.withLongOpt( "v1-local-repository" ).withDescription( - "Use legacy layout for local artifact repository" ).create( VERSION_1_REPO ) ); - - options.addOption( OptionBuilder.withLongOpt( "v2-local-repository" ).withDescription( - "Use new layout for local artifact repository" ).create( VERSION_2_REPO ) ); options.addOption( OptionBuilder.withLongOpt( "update-snapshots" ).withDescription( "Update all snapshots regardless of repository policies" ).create( UPDATE_SNAPSHOTS ) ); } 1.27 +31 -22 maven-components/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java Index: Verifier.java =================================================================== RCS file: /home/cvs/maven-components/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- Verifier.java 4 Apr 2005 06:15:03 -0000 1.26 +++ Verifier.java 4 Apr 2005 06:47:21 -0000 1.27 @@ -49,7 +49,7 @@ private final PrintStream originalErr; // TODO: needs to be configurable - private static String localRepoLayout = "legacy"; + private static String localRepoLayout = "default"; public Verifier( String basedir ) { @@ -96,7 +96,8 @@ // // ---------------------------------------------------------------------- - public void verify() throws VerificationException + public void verify() + throws VerificationException { List lines = loadFile( basedir, "expected-results.txt" ); @@ -120,12 +121,14 @@ } } - private static List loadFile( String basedir, String filename ) throws VerificationException + private static List loadFile( String basedir, String filename ) + throws VerificationException { return loadFile( new File( basedir, filename ) ); } - private static List loadFile( File file ) throws VerificationException + private static List loadFile( File file ) + throws VerificationException { List lines = new ArrayList(); @@ -144,7 +147,6 @@ continue; } - line = replaceArtifacts( line ); lines.add( line ); @@ -220,7 +222,8 @@ return localRepo + "/" + repositoryPath; } - public void executeHook( String filename ) throws VerificationException + public void executeHook( String filename ) + throws VerificationException { try { @@ -250,7 +253,8 @@ } } - private static void executeCommand( String line ) throws VerificationException + private static void executeCommand( String line ) + throws VerificationException { int index = line.indexOf( " " ); @@ -334,7 +338,8 @@ return repo; } - private void verifyExpectedResult( String line ) throws VerificationException + private void verifyExpectedResult( String line ) + throws VerificationException { if ( line.indexOf( "!/" ) > 0 ) { @@ -378,7 +383,8 @@ // // ---------------------------------------------------------------------- - public void executeGoals( String filename ) throws VerificationException + public void executeGoals( String filename ) + throws VerificationException { String mavenHome = System.getProperty( "maven.home" ); @@ -584,8 +590,8 @@ private final void printParseError( String type, SAXParseException spe ) { - System.err.println( type + " [line " + spe.getLineNumber() + ", row " + spe.getColumnNumber() + "]: " - + spe.getMessage() ); + System.err.println( type + " [line " + spe.getLineNumber() + ", row " + spe.getColumnNumber() + "]: " + + spe.getMessage() ); } public Profile getActiveMavenProfile() @@ -593,12 +599,14 @@ return activeMavenProfile; } - public void characters( char[] ch, int start, int length ) throws SAXException + public void characters( char[] ch, int start, int length ) + throws SAXException { currentBody.append( ch, start, length ); } - public void endElement( String uri, String localName, String rawName ) throws SAXException + public void endElement( String uri, String localName, String rawName ) + throws SAXException { if ( "profile".equals( rawName ) ) { @@ -609,15 +617,15 @@ } else { - throw new SAXException( "Invalid mavenProfile entry. Missing one or more " - + "fields: {localRepository}." ); + throw new SAXException( "Invalid mavenProfile entry. Missing one or more " + + "fields: {localRepository}." ); } } else if ( currentProfile != null ) { if ( "active".equals( rawName ) ) { - currentProfile.setActive( Boolean.valueOf(currentBody.toString().trim()).booleanValue() ); + currentProfile.setActive( Boolean.valueOf( currentBody.toString().trim() ).booleanValue() ); } else if ( "localRepository".equals( rawName ) ) { @@ -630,16 +638,16 @@ } else if ( "settings".equals( rawName ) ) { - if(profiles.size() == 1) + if ( profiles.size() == 1 ) { - activeMavenProfile = (Profile) profiles.get(0); + activeMavenProfile = (Profile) profiles.get( 0 ); } else { for ( Iterator it = profiles.iterator(); it.hasNext(); ) { Profile profile = (Profile) it.next(); - if(profile.isActive()) + if ( profile.isActive() ) { activeMavenProfile = profile; } @@ -677,6 +685,7 @@ { private String localRepository; + private boolean active = false; public void setLocalRepo( String localRepo ) @@ -688,12 +697,12 @@ { return localRepository; } - + public void setActive( boolean active ) { this.active = active; } - + public boolean isActive() { return active; 1.9 +1 -2 maven-components/maven-mboot2/src/main/java/download/ArtifactDownloader.java Index: ArtifactDownloader.java =================================================================== RCS file: /home/cvs/maven-components/maven-mboot2/src/main/java/download/ArtifactDownloader.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- ArtifactDownloader.java 4 Apr 2005 06:35:40 -0000 1.8 +++ ArtifactDownloader.java 4 Apr 2005 06:47:21 -0000 1.9 @@ -114,8 +114,7 @@ if ( repositories.isEmpty() ) { // TODO: use super POM? - Repository repository = new Repository(); - repository.setBasedir( "http://repo1.maven.org" ); + Repository repository = new Repository( "http://repo1.maven.org", Repository.LAYOUT_LEGACY ); remoteRepos.add( repository ); } } 1.3 +2 -2 maven-components/maven-mboot2/src/main/java/model/Repository.java Index: Repository.java =================================================================== RCS file: /home/cvs/maven-components/maven-mboot2/src/main/java/model/Repository.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Repository.java 4 Apr 2005 05:23:01 -0000 1.2 +++ Repository.java 4 Apr 2005 06:47:21 -0000 1.3 @@ -32,7 +32,7 @@ private String basedir; - private String layout = LAYOUT_LEGACY; + private String layout; public Repository() { 1.90 +1 -1 maven-components/maven-mboot2/src/main/java/MBoot.java Index: MBoot.java =================================================================== RCS file: /home/cvs/maven-components/maven-mboot2/src/main/java/MBoot.java,v retrieving revision 1.89 retrieving revision 1.90 diff -u -r1.89 -r1.90 --- MBoot.java 4 Apr 2005 05:41:57 -0000 1.89 +++ MBoot.java 4 Apr 2005 06:47:21 -0000 1.90 @@ -240,7 +240,7 @@ online = false; } - Repository localRepository = new Repository( mavenRepoLocal, Repository.LAYOUT_LEGACY ); + Repository localRepository = new Repository( mavenRepoLocal, Repository.LAYOUT_DEFAULT ); ModelReader reader = new ModelReader( localRepository );