o Simplified the ResourcesMojo to eliminate the need for a ResourceEntry class, which is easily replaced by usage of a TreeMap (avoid the NoClassDefFoundError from before SEE MNG-243)

o Changed the references to repo1.maven.org for central repository to repo1.maven.org/maven2 in preparation for switchover to ibiblio.org

    This will allow us to transparently switch between redirects and CNAME changes for referencing ibiblio.org, since ibiblio will not allow a
    vhost for m2 or a rewrite rule...switching the URL for the repo will allow changes to the CNAME (satisfy ibiblio's pathing) while at the same
    time allowing the use of redirects (redirect can be at /maven2/index.html rather than /index.html, f.e.).


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163772 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-04-04 21:32:53 +00:00
parent 4862d0cf8f
commit fcb7a1c14b
4 changed files with 26 additions and 44 deletions

View File

@ -374,7 +374,7 @@ public class DefaultMavenProjectBuilder
Repository pluginRepo = new Repository(); Repository pluginRepo = new Repository();
pluginRepo.setId( "plugin-repository" ); pluginRepo.setId( "plugin-repository" );
pluginRepo.setUrl( "http://repo1.maven.org" ); pluginRepo.setUrl( "http://repo1.maven.org/maven2" );
// TODO: [jc] change this to detect the repository layout type somehow... // TODO: [jc] change this to detect the repository layout type somehow...
String repoLayoutId = "legacy"; String repoLayoutId = "legacy";

View File

@ -6,7 +6,7 @@
<repository> <repository>
<id>central</id> <id>central</id>
<name>Maven Repository Switchboard</name> <name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org</url> <url>http://repo1.maven.org/maven2</url>
</repository> </repository>
</repositories> </repositories>
@ -33,22 +33,22 @@
<pluginManagement> <pluginManagement>
<plugins> <plugins>
<plugin> <plugin>
<groupId>maven</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>maven</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId> <artifactId>maven-resources-plugin</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>maven</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId> <artifactId>maven-jar-plugin</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>maven</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId> <artifactId>maven-surefire-plugin</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<configuration> <configuration>
@ -61,27 +61,27 @@
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>maven</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId> <artifactId>maven-clean-plugin</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>maven</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId> <artifactId>maven-deploy-plugin</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>maven</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId> <artifactId>maven-install-plugin</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>maven</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pom-plugin</artifactId> <artifactId>maven-pom-plugin</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</plugin> </plugin>
<plugin> <plugin>
<groupId>maven</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId> <artifactId>maven-plugin-plugin</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</plugin> </plugin>

View File

@ -115,7 +115,7 @@ public class ArtifactDownloader
if ( repositories.isEmpty() ) if ( repositories.isEmpty() )
{ {
// TODO: use super POM? // TODO: use super POM?
Repository repository = new Repository( "http://repo1.maven.org", Repository.LAYOUT_LEGACY ); Repository repository = new Repository( "http://repo1.maven.org/maven2", Repository.LAYOUT_LEGACY );
remoteRepos.add( repository ); remoteRepos.add( repository );
} }
} }

View File

@ -30,6 +30,9 @@ import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.Map.Entry;
/** /**
* @author <a href="michal.maczka@dimatics.com">Michal Maczka</a> * @author <a href="michal.maczka@dimatics.com">Michal Maczka</a>
@ -62,18 +65,20 @@ public class ResourcesMojo
{ {
try try
{ {
for ( Iterator i = getJarResources( resources ).iterator(); i.hasNext(); ) for ( Iterator i = getJarResources( resources ).entrySet().iterator(); i.hasNext(); )
{ {
ResourceEntry resourceEntry = (ResourceEntry) i.next(); Map.Entry entry = (Entry) i.next();
String source = (String) entry.getKey();
String destination = (String) entry.getValue();
File destinationFile = new File( outputDirectory, resourceEntry.getDestination() ); File destinationFile = new File( outputDirectory, destination );
if ( !destinationFile.getParentFile().exists() ) if ( !destinationFile.getParentFile().exists() )
{ {
destinationFile.getParentFile().mkdirs(); destinationFile.getParentFile().mkdirs();
} }
fileCopy( resourceEntry.getSource(), destinationFile.getPath() ); fileCopy( source, destinationFile.getPath() );
} }
} }
catch ( Exception e ) catch ( Exception e )
@ -83,10 +88,10 @@ public class ResourcesMojo
} }
} }
private List getJarResources( List resources ) private Map getJarResources( List resources )
throws Exception throws Exception
{ {
List resourceEntries = new ArrayList(); Map resourceEntries = new TreeMap();
for ( Iterator i = resources.iterator(); i.hasNext(); ) for ( Iterator i = resources.iterator(); i.hasNext(); )
{ {
@ -139,9 +144,9 @@ public class ResourcesMojo
entryName = targetPath + "/" + name; entryName = targetPath + "/" + name;
} }
ResourceEntry je = new ResourceEntry( new File( resource.getDirectory(), name ).getPath(), entryName ); String resourcePath = new File( resource.getDirectory(), name ).getPath();
resourceEntries.add( je ); resourceEntries.put( resourcePath, entryName );
} }
} }
@ -185,27 +190,4 @@ public class ResourcesMojo
fileWrite( outFileName, content ); fileWrite( outFileName, content );
} }
class ResourceEntry
{
private String source;
private String destination;
public ResourceEntry( String source, String entry )
{
this.source = source;
this.destination = entry;
}
public String getSource()
{
return source;
}
public String getDestination()
{
return destination;
}
}
} }