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();
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...
String repoLayoutId = "legacy";

View File

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

View File

@ -115,7 +115,7 @@ public class ArtifactDownloader
if ( repositories.isEmpty() )
{
// 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 );
}
}

View File

@ -30,6 +30,9 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
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>
@ -62,18 +65,20 @@ public class ResourcesMojo
{
try
{
for ( Iterator i = getJarResources( resources ).iterator(); i.hasNext(); )
for ( Iterator i = getJarResources( resources ).entrySet().iterator(); i.hasNext(); )
{
ResourceEntry resourceEntry = (ResourceEntry) i.next();
File destinationFile = new File( outputDirectory, resourceEntry.getDestination() );
Map.Entry entry = (Entry) i.next();
String source = (String) entry.getKey();
String destination = (String) entry.getValue();
File destinationFile = new File( outputDirectory, destination );
if ( !destinationFile.getParentFile().exists() )
{
destinationFile.getParentFile().mkdirs();
}
fileCopy( resourceEntry.getSource(), destinationFile.getPath() );
fileCopy( source, destinationFile.getPath() );
}
}
catch ( Exception e )
@ -83,10 +88,10 @@ public class ResourcesMojo
}
}
private List getJarResources( List resources )
private Map getJarResources( List resources )
throws Exception
{
List resourceEntries = new ArrayList();
Map resourceEntries = new TreeMap();
for ( Iterator i = resources.iterator(); i.hasNext(); )
{
@ -139,9 +144,9 @@ public class ResourcesMojo
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 );
}
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;
}
}
}