[Jpackage-commits] dist/maven22/devel .cvsignore, 1.1, 1.2 maven2-2.2.1-default-resolver-pool-size.patch, NONE, 1.1 maven2-2.2.1-depmap.xml, NONE, 1.1 maven2-2.2.1-enable-bootstrap-repo.patch, NONE, 1.1 maven2-2.2.1-jpp.patch, NONE, 1.1 maven2-2.2.1-settings.xml, NONE, 1.1 maven2-2.2.1-unshade.patch, NONE, 1.1 maven2-2.2.1-update-tests.patch, NONE, 1.1 maven2-JPackageRepositoryLayout.java, NONE, 1.1 maven2-MavenJPackageDepmap.java, NONE, 1.1 maven2-RELEASE.patch, NONE, 1.1 maven2-antbuild.patch, NONE, 1.1 maven2-empty-dep.pom, NONE, 1.1 maven2-jpp-script, NONE, 1.1 maven2-script, NONE, 1.1 maven22.spec, NONE, 1.1 sources, 1.1, 1.2

David Walluck david at ryu.zarb.org
Tue Oct 11 22:23:33 CEST 2011


Update of /home/projects/jpackage/cvs/dist/maven22/devel
In directory ryu.zarb.org:/tmp/cvs-serv20766/devel

Modified Files:
	.cvsignore sources 
Added Files:
	maven2-2.2.1-default-resolver-pool-size.patch 
	maven2-2.2.1-depmap.xml 
	maven2-2.2.1-enable-bootstrap-repo.patch 
	maven2-2.2.1-jpp.patch maven2-2.2.1-settings.xml 
	maven2-2.2.1-unshade.patch maven2-2.2.1-update-tests.patch 
	maven2-JPackageRepositoryLayout.java 
	maven2-MavenJPackageDepmap.java maven2-RELEASE.patch 
	maven2-antbuild.patch maven2-empty-dep.pom maven2-jpp-script 
	maven2-script maven22.spec 
Log Message:
- initial import

Index: .cvsignore
===================================================================
RCS file: /home/projects/jpackage/cvs/dist/maven22/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -d -r1.1 -r1.2
*** .cvsignore	11 Oct 2011 20:09:26 -0000	1.1
--- .cvsignore	11 Oct 2011 20:23:31 -0000	1.2
***************
*** 0 ****
--- 1,3 ----
+ maven2-2.2.1-bootstrapdeps.tar.gz
+ maven2-2.2.1.tar.gz
+ maven2-empty-dep.jar

--- NEW FILE: maven2-RELEASE.patch ---
diff -ur maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/ReleaseArtifactTransformation.java apache-maven-2.2.1/maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/ReleaseArtifactTransformation.java
--- maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/ReleaseArtifactTransformation.java	2007-01-11 02:47:53.000000000 -0500
+++ maven-artifact-manager/src/main/java/org/apache/maven/artifact/transform/ReleaseArtifactTransformation.java	2010-10-19 17:11:07.000000000 -0400
@@ -46,7 +46,11 @@
         {
             try
             {
-                String version = resolveVersion( artifact, localRepository, remoteRepositories );
+                String version;
+				if (System.getProperty("maven2.ignore.versions") != null)  
+					version = "2.0.8";
+				else
+					version = resolveVersion( artifact, localRepository, remoteRepositories );
 
                 if ( Artifact.RELEASE_VERSION.equals( version ) )
                 {

--- NEW FILE: maven2-script ---
#!/bin/sh
if [ -f /usr/share/java-utils/java-functions ] ; then
  . /usr/share/java-utils/java-functions
  set_jvm
  set_javacmd
fi

export M2_HOME=/usr/share/maven2
echo $JAVA_HOME
export JAVA_HOME; $M2_HOME/bin/mvn $@

--- NEW FILE: maven2-JPackageRepositoryLayout.java ---
package org.apache.maven.artifact.repository.layout;

/*
 * Copyright 2001-2005 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *	  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.handler.ArtifactHandler;
import org.apache.maven.artifact.metadata.ArtifactMetadata;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.xml.sax.InputSource;

/**
 * Repository layout for jpackage based repositories. 
 * This class resolves items for jpp style repos (i.e things located in 
 * /usr/share/java).
 */

public class JPackageRepositoryLayout
	implements ArtifactRepositoryLayout
{
	private static Hashtable jppArtifactMap;

	private static final char GROUP_SEPARATOR = '.';
	private static final char PATH_SEPARATOR = '/';

	public String pathOf( Artifact artifact )
	{

		ArtifactHandler artifactHandler = artifact.getArtifactHandler();
		StringBuffer path = new StringBuffer();

		String artifactId = artifact.getArtifactId();
		String groupId = artifact.getGroupId();
		String version = artifact.getVersion();
		String classifierSuffix = (artifact.getClassifier() == null || artifact.getClassifier() == "") ? 
		                          "" : "-" + artifact.getClassifier();

		if (!groupId.startsWith("JPP")) {
			MavenJPackageDepmap map = MavenJPackageDepmap.getInstance();
			Hashtable newInfo = map.getMappedInfo(groupId, artifactId, version);
			
			groupId = (String) newInfo.get("group");
			artifactId = (String) newInfo.get("artifact");
		}

		if (groupId.startsWith("JPP")) {
			if (artifactHandler.getPackaging().equals("pom")) {
				path = getPOMPath(groupId, artifactId);

			} else {    // Assume if it is not pom it is jar
                                    // as "maven-plugin" type is a JAR
				path.append( groupId ).append( '/' );
				path.append( artifactId ).append(classifierSuffix).append( "." + artifactHandler.getExtension());
			}
		} else {
			path.append( groupId.replace(GROUP_SEPARATOR, PATH_SEPARATOR) ).append( '/' ).append( artifactId ).append( '/' ).append( version ).append( '/' );
			path.append( artifactId ).append( '-' ).append( version ).append( "." );
                        // Parent poms may come with type "xml"
			if (artifactHandler.getPackaging().equals("xml")) {
				path.append( "pom" );
			} else {
				path.append( artifactHandler.getPackaging() );
			}
		}

		return path.toString();
	}

	private StringBuffer getPOMPath(String groupId, String artifactId) {

		StringBuffer path = new StringBuffer();
		String fName = groupId.replace(PATH_SEPARATOR, GROUP_SEPARATOR) + "-" + artifactId + ".pom";
		path.append(System.getProperty("maven2.jpp.pom.path", "JPP/maven2/poms")).append("/").append(fName);
		java.io.File f;

		// NOTE: We are returning default_poms/ as the path for this pom 
		// even though it may not exist there. This may cause an error, 
		// but that is fine because if the pom is not there, there is 
		// a serious problem anyways..
		f = new java.io.File(System.getProperty("maven2.jpp.default.repo", "/usr/share/maven2/repository") + "/" + path.toString());
		//System.err.println("Checking path " + f.getAbsolutePath() + " for the pom");
		if (!f.exists()) {
            System.err.println(f.getAbsolutePath() + " not found");
			path = new StringBuffer();
			path.append(System.getProperty("maven2.jpp.default.pom.path", "JPP/maven2/default_poms")).append("/").append(fName);
		}

		return path;
	}

	public String pathOfLocalRepositoryMetadata( ArtifactMetadata metadata, ArtifactRepository repository )
	{
		return pathOfRepositoryMetadata( metadata, metadata.getLocalFilename( repository ) );
	}

	private String pathOfRepositoryMetadata( ArtifactMetadata metadata, String filename )
	{

        StringBuffer path = new StringBuffer();

        if (filename.substring(filename.length()-4).equals(".pom")) {
			path = getPOMPath(metadata.getGroupId(), metadata.getArtifactId());
        } else {

		// FIXME: If it gets here, something other than a pom was requested.. where are those things located?
		path.append(System.getProperty("maven2.jpp.pom.path", "maven2/poms")).append("/").append(filename);
        }

		return path.toString();
	}

	public String pathOfRemoteRepositoryMetadata( ArtifactMetadata metadata )
	{
		return pathOfRepositoryMetadata( metadata, metadata.getRemoteFilename() );
	}
}

--- NEW FILE: maven2-2.2.1-enable-bootstrap-repo.patch ---
diff -up ./maven-project/src/main/resources/org/apache/maven/project/pom-4.0.0.xml.sav ./maven-project/src/main/resources/org/apache/maven/project/pom-4.0.0.xml
--- ./maven-project/src/main/resources/org/apache/maven/project/pom-4.0.0.xml.sav	2009-11-19 21:48:25.214582305 -0500
+++ ./maven-project/src/main/resources/org/apache/maven/project/pom-4.0.0.xml	2009-11-20 00:02:16.608725006 -0500
@@ -33,6 +33,15 @@ under the License.
       </snapshots>
     </repository>
     <repository>
+      <id>__bootstrap_jpp_repo__</id>
+      <name>Maven Bootstrap Repository</name>
+      <layout>default</layout>
+      <url>file:///usr/share/maven2/bootstrap_repo</url>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </repository>
+    <repository>
       <id>__jpp_repo__</id>
       <name>JPackage Maven Repository</name>
       <layout>jpp</layout>
@@ -57,6 +66,18 @@ under the License.
       </releases>
     </pluginRepository>
     <pluginRepository>
+      <id>__bootstrap_jpp_repo__</id>
+      <name>Maven Bootstrap Repository</name>
+      <layout>default</layout>
+      <url>file:///usr/share/maven2/bootstrap_repo</url>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+      <releases>
+        <updatePolicy>never</updatePolicy>
+      </releases>
+    </pluginRepository>
+    <pluginRepository>
       <id>__jpp_repo__</id>
       <name>JPackage Maven Repository</name>
       <layout>jpp</layout>

--- NEW FILE: maven2-2.2.1-jpp.patch ---
diff -up ./maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java.sav ./maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java
--- ./maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java.sav	2009-08-06 15:11:34.000000000 -0400
+++ ./maven-artifact-manager/src/main/java/org/apache/maven/artifact/manager/DefaultWagonManager.java	2009-11-19 14:17:42.000000000 -0500
@@ -58,6 +58,8 @@ import org.codehaus.plexus.util.FileUtil
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.xml.Xpp3Dom;
 
+import org.apache.maven.artifact.repository.layout.MavenJPackageDepmap;
+
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -66,6 +68,7 @@ import java.net.URL;
 import java.security.NoSuchAlgorithmException;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -409,7 +412,20 @@ public class DefaultWagonManager
                              ArtifactRepository repository )
         throws TransferFailedException, ResourceDoesNotExistException
     {
+
+        String originalVersion = artifact.getVersion();
+        
+        if ( ( repository.getLayout() instanceof org.apache.maven.artifact.repository.layout.JPackageRepositoryLayout ) &&
+             ( System.getProperty("maven2.jpp.mode") != null ) )
+        {
+            MavenJPackageDepmap map = MavenJPackageDepmap.getInstance();
+            Hashtable newInfo = map.getMappedInfo(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion());
+
+            artifact.setVersion((String) newInfo.get("version"));
+        }
+
         String remotePath = repository.pathOf( artifact );
+        artifact.setVersion(originalVersion); // set it back
 
         ArtifactRepositoryPolicy policy = artifact.isSnapshot() ? repository.getSnapshots() : repository.getReleases();
 
@@ -421,8 +437,31 @@ public class DefaultWagonManager
         {
             getLogger().debug( "Skipping blacklisted repository " + repository.getId() );
         }
+        else if ((System.getProperty("maven2.jpp.mode") != null) && 
+                 (!repository.getUrl().startsWith("file:")))
+        {
+            // In JPP mode, repos other than those starting with file:// are 
+            // not allowed
+            getLogger().warn( "Skipping non filebased repository " + repository.getUrl() + " in full offline mode");
+        }
+        else if ((System.getProperty("maven2.jpp.mode") != null) && 
+                 (System.getProperty("maven2.jpp.signed") == null) &&
+                 (repository.getId().startsWith("__jpps")))
+        {
+            // In JPP mode, if use of signed JARs is not requested, the
+            // __jpps_repo__ is skipped
+            getLogger().warn( "Skipping jpp signed repository " + repository.getUrl() + " as maven2.jpp.signed is not set");
+        }
         else
         {
+            // In vanilla mode, the JPP repos should be ignored
+            if ((System.getProperty("maven2.jpp.mode") == null) &&
+                (repository.getId().startsWith("__jpp")))
+            {
+                getLogger().warn( "Skipping jpp repository " + repository.getUrl() + " in vanilla mode");
+                return;
+            }
+
             getLogger().debug( "Trying repository " + repository.getId() );
             getRemoteFile( getMirrorRepository( repository ), artifact.getFile(), remotePath, downloadMonitor,
                                    policy.getChecksumPolicy(), false );
diff -up ./maven-artifact-manager/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java.sav ./maven-artifact-manager/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java
--- ./maven-artifact-manager/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java.sav	2009-08-06 15:11:34.000000000 -0400
+++ ./maven-artifact-manager/src/main/java/org/apache/maven/artifact/repository/metadata/DefaultRepositoryMetadataManager.java	2009-11-18 16:54:39.000000000 -0500
@@ -85,7 +85,7 @@ public class DefaultRepositoryMetadataMa
                     boolean checkForUpdates =
                         !file.exists() || policy.checkOutOfDate( new Date( file.lastModified() ) );
 
-                    if ( checkForUpdates )
+                    if ( checkForUpdates && (System.getProperty("maven2.jpp.mode") == null))
                     {
                         if ( wagonManager.isOnline() )
                         {
diff -up ./maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java.sav ./maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
--- ./maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java.sav	2009-08-06 15:11:34.000000000 -0400
+++ ./maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java	2009-11-18 16:54:39.000000000 -0500
@@ -206,7 +206,8 @@ public class DefaultArtifactResolver
                 try
                 {
                     // TODO: force should be passed to the wagon manager
-                    if ( artifact.getRepository() != null )
+                    if ( (artifact.getRepository() != null) &&
+                         (System.getProperty("maven2.jpp.mode") == null))
                     {
                         // the transformations discovered the artifact - so use it exclusively
                         wagonManager.getArtifact( artifact, artifact.getRepository() );
diff -up ./maven-artifact/pom.xml.sav ./maven-artifact/pom.xml
--- ./maven-artifact/pom.xml.sav	2009-08-06 15:11:32.000000000 -0400
+++ ./maven-artifact/pom.xml	2009-11-19 14:54:43.000000000 -0500
@@ -39,5 +39,10 @@ under the License.
       <artifactId>plexus-container-default</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>jdom</groupId>
+      <artifactId>jdom</artifactId>
+      <version>1.0</version>
+    </dependency>
   </dependencies>
 </project>
diff -up ./maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java.sav ./maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java
--- ./maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java.sav	2009-08-06 15:11:31.000000000 -0400
+++ ./maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/DefaultRepositoryLayout.java	2009-11-19 14:15:45.000000000 -0500
@@ -23,6 +23,9 @@ import org.apache.maven.artifact.Artifac
 import org.apache.maven.artifact.handler.ArtifactHandler;
 import org.apache.maven.artifact.metadata.ArtifactMetadata;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.layout.MavenJPackageDepmap;
+
+import java.util.Hashtable;
 
 /**
  * @author jdcasey
@@ -42,6 +45,8 @@ public class DefaultRepositoryLayout
 
         StringBuffer path = new StringBuffer();
 
+        String baseVersion = artifact.getBaseVersion();
+
         path.append( formatAsDirectory( artifact.getGroupId() ) ).append( PATH_SEPARATOR );
         path.append( artifact.getArtifactId() ).append( PATH_SEPARATOR );
         path.append( artifact.getBaseVersion() ).append( PATH_SEPARATOR );
@@ -76,7 +81,17 @@ public class DefaultRepositoryLayout
 
             if ( metadata.storedInArtifactVersionDirectory() )
             {
-                path.append( metadata.getBaseVersion() ).append( PATH_SEPARATOR );
+                String baseVersion = metadata.getBaseVersion();
+
+                if (System.getProperty("maven2.jpp.mode") != null)
+                {
+                    MavenJPackageDepmap map = MavenJPackageDepmap.getInstance();
+                    Hashtable newInfo = map.getMappedInfo(metadata.getGroupId(), metadata.getArtifactId(), baseVersion);
+
+                    baseVersion = (String) newInfo.get("version");
+                }
+
+                path.append( baseVersion ).append( PATH_SEPARATOR );
             }
         }
 
diff -up ./maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java.sav ./maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java
--- ./maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java.sav	2009-08-06 15:11:32.000000000 -0400
+++ ./maven-artifact/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactCollector.java	2009-11-18 16:54:39.000000000 -0500
@@ -341,7 +341,7 @@ public class DefaultArtifactCollector
                                 // set the recommended version
                                 // TODO: maybe its better to just pass the range through to retrieval and use a transformation?
                                 ArtifactVersion version;
-                                if ( artifact.isSelectedVersionKnown() )
+                                if ( artifact.isSelectedVersionKnown() && System.getProperty("maven2.jpp.mode") == null)
                                 {
                                     version = artifact.getSelectedVersion();
                                 }
@@ -380,7 +380,12 @@ public class DefaultArtifactCollector
                                 //this is dangerous because artifact.getSelectedVersion() can
                                 //return null. However it is ok here because we first check if the
                                 //selected version is known. As currently coded we can't get a null here.
-                                artifact.selectVersion( version.toString() );
+
+                                if ( !artifact.isSelectedVersionKnown() && System.getProperty("maven2.jpp.mode") != null)
+                                    artifact.selectVersion( "DUMMY_VER" );
+                                else
+                                    artifact.selectVersion( version.toString() );
+                                
                                 fireEvent( ResolutionListener.SELECT_VERSION_FROM_RANGE, listeners, child );
                             }
 
diff -up ./maven-artifact/src/main/resources/META-INF/plexus/components.xml.sav ./maven-artifact/src/main/resources/META-INF/plexus/components.xml
--- ./maven-artifact/src/main/resources/META-INF/plexus/components.xml.sav	2009-08-06 15:11:32.000000000 -0400
+++ ./maven-artifact/src/main/resources/META-INF/plexus/components.xml	2009-11-18 16:54:39.000000000 -0500
@@ -31,6 +31,12 @@ under the License.
       <implementation>org.apache.maven.artifact.repository.layout.LegacyRepositoryLayout</implementation>
     </component>
 
+    <component>
+      <role>org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout</role>
+      <role-hint>jpp</role-hint>
+      <implementation>org.apache.maven.artifact.repository.layout.JPackageRepositoryLayout</implementation>
+    </component>
+
     <!--
      |
      | ArtifactHandlerManager
diff -up ./maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java.sav ./maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
diff -up ./maven-core/src/main/java/org/apache/maven/plugin/MavenPluginCollector.java.sav ./maven-core/src/main/java/org/apache/maven/plugin/MavenPluginCollector.java
--- ./maven-core/src/main/java/org/apache/maven/plugin/MavenPluginCollector.java.sav	2009-11-19 11:36:53.000000000 -0500
+++ ./maven-core/src/main/java/org/apache/maven/plugin/MavenPluginCollector.java	2009-11-19 11:47:25.000000000 -0500
@@ -60,6 +60,7 @@ public class MavenPluginCollector
             {
                 pluginsInProcess.add( key );
 
+                System.err.println("*DEBUG*: Putting in plugin descriptor list " + key + " and goal prefix is " + pluginDescriptor.getGoalPrefix());
                 pluginDescriptors.put( key, pluginDescriptor );
 
                 // TODO: throw an (not runtime) exception if there is a prefix overlap - means doing so elsewhere
@@ -75,6 +76,17 @@ public class MavenPluginCollector
     public PluginDescriptor getPluginDescriptor( Plugin plugin )
     {
         String key = PluginUtils.constructVersionedKey( plugin );
+        System.err.println("*DEBUG*: Constructed plugin version key is " + key);
+
+        PluginDescriptor descriptor = (PluginDescriptor) pluginDescriptors.get( key );
+
+        // In JPP mode, we give it a second chance
+        if ( ( descriptor == null ) && 
+             ( System.getProperty("maven2.jpp.mode") != null ) )
+        {
+            //for descriptors
+        }
+
         return (PluginDescriptor) pluginDescriptors.get( key );
     }
 
diff -up ./maven-core/src/main/java/org/apache/maven/plugin/MavenPluginValidator.java.sav ./maven-core/src/main/java/org/apache/maven/plugin/MavenPluginValidator.java
--- ./maven-core/src/main/java/org/apache/maven/plugin/MavenPluginValidator.java.sav	2009-11-19 11:08:06.000000000 -0500
+++ ./maven-core/src/main/java/org/apache/maven/plugin/MavenPluginValidator.java	2009-11-19 11:08:29.000000000 -0500
@@ -57,8 +57,10 @@ public class MavenPluginValidator
             {
                 errors.add( "Plugin's descriptor contains the wrong artifact ID: " + pluginDescriptor.getArtifactId() );
             }
-            
-            if ( !pluginArtifact.getBaseVersion().equals( pluginDescriptor.getVersion() ) )
+
+            if ( !pluginArtifact.getBaseVersion().equals( pluginDescriptor.getVersion() ) && 
+                 ( System.getProperty("maven2.jpp.mode") == null ) 
+               )            
             {
                 errors.add( "Plugin's descriptor contains the wrong version: " + pluginDescriptor.getVersion() );
             }
diff -up ./maven-core/src/main/java/org/apache/maven/plugin/PluginUtils.java.sav ./maven-core/src/main/java/org/apache/maven/plugin/PluginUtils.java
--- ./maven-core/src/main/java/org/apache/maven/plugin/PluginUtils.java.sav	2009-11-19 11:51:04.000000000 -0500
+++ ./maven-core/src/main/java/org/apache/maven/plugin/PluginUtils.java	2009-11-19 12:00:15.000000000 -0500
@@ -72,7 +72,13 @@ class PluginUtils
         String baseVersion = ArtifactUtils.toSnapshotVersion( version );
 
         StringBuffer key = new StringBuffer( 128 );
-        key.append( groupId ).append( ':' ).append( artifactId ).append( ':' ).append( baseVersion );
+
+        // In JPP mode, we don't want to use versions in keys
+
+        if (System.getProperty("maven2.jpp.mode") == null)
+            key.append( groupId ).append( ':' ).append( artifactId ).append( ':' ).append( baseVersion );
+        else
+            key.append( groupId ).append( ':' ).append( artifactId );
         return key.toString();
     }
 
diff -up ./maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java.sav ./maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
--- ./maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java.sav	2009-08-06 15:11:28.000000000 -0400
+++ ./maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java	2009-11-18 16:54:39.000000000 -0500
@@ -224,9 +224,15 @@ public class DefaultPluginVersionManager
         }
 
         // if we still haven't found a version, then fail early before we get into the update goop.
-        if ( StringUtils.isEmpty( version ) )
+        if ( (StringUtils.isEmpty( version )) && (System.getProperty("maven2.jpp.mode") == null))
         {
             throw new PluginVersionNotFoundException( groupId, artifactId );
+        } else if (System.getProperty("maven2.jpp.mode") != null)
+        {
+            // Doesn't matter what we have here. We need *something* because 
+            // metadata is not retrieved in offline mode, so there needs to be
+            // some kind of version
+            version = "DUMMY_VER";
         }
 
         // if the plugin registry is inactive, then the rest of this goop is useless...
diff -up ./maven-project/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java.sav ./maven-project/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java
--- ./maven-project/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java.sav	2009-08-06 15:11:37.000000000 -0400
+++ ./maven-project/src/main/java/org/apache/maven/project/validation/DefaultModelValidator.java	2009-11-18 16:54:39.000000000 -0500
@@ -43,7 +43,7 @@ import java.util.List;
 public class DefaultModelValidator
     implements ModelValidator
 {
-    private static final String ID_REGEX = "[A-Za-z0-9_\\-.]+";
+    private static final String ID_REGEX = "[A-Za-z0-9_/\\\\.-]+";
 
     ///////////////////////////////////////////////////////////////////////////
     // ModelValidator Implementation
@@ -88,7 +88,13 @@ public class DefaultModelValidator
 
             validateStringNotEmpty( "dependencies.dependency.type", result, d.getType(), d.getManagementKey() );
 
-            validateStringNotEmpty( "dependencies.dependency.version", result, d.getVersion(), d.getManagementKey() );
+            // In JPP mode, don't bother validating. But do put a dummy 
+            // version if one is not provided
+            if ((System.getProperty("maven2.jpp.mode") != null) &&
+                (d.getVersion() == null)) 
+                d.setVersion("DUMMY_VER");
+            else
+                validateStringNotEmpty( "dependencies.dependency.version", result, d.getVersion(), d.getManagementKey() );
 
             if ( Artifact.SCOPE_SYSTEM.equals( d.getScope() ) )
             {
diff -up ./maven-project/src/main/resources/org/apache/maven/project/pom-4.0.0.xml.sav ./maven-project/src/main/resources/org/apache/maven/project/pom-4.0.0.xml
--- ./maven-project/src/main/resources/org/apache/maven/project/pom-4.0.0.xml.sav	2009-08-06 15:11:38.000000000 -0400
+++ ./maven-project/src/main/resources/org/apache/maven/project/pom-4.0.0.xml	2009-11-19 13:12:23.000000000 -0500
@@ -32,6 +32,24 @@ under the License.
         <enabled>false</enabled>
       </snapshots>
     </repository>
+    <repository>
+      <id>__jpps_repo__</id>
+      <name>JPackage Maven Repository</name>
+      <layout>jpp</layout>
+      <url>file:///usr/share/maven2/repository-signed</url>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </repository>
+    <repository>
+      <id>__jpp_repo__</id>
+      <name>JPackage Maven Repository</name>
+      <layout>jpp</layout>
+      <url>file:///usr/share/maven2/repository</url>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+    </repository>
   </repositories>
 
   <pluginRepositories>
@@ -47,6 +65,31 @@ under the License.
         <updatePolicy>never</updatePolicy>
       </releases>
     </pluginRepository>
+    <pluginRepository>
+      <id>__jpps_repo__</id>
+      <name>JPackage Maven Repository</name>
+      <layout>jpp</layout>
+      <url>file:///usr/share/maven2/repository-signed</url>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+      <releases>
+        <updatePolicy>never</updatePolicy>
+      </releases>
+    </pluginRepository>
+    <pluginRepository>
+      <id>__jpp_repo__</id>
+      <name>JPackage Maven Repository</name>
+      <layout>jpp</layout>
+      <url>file:///usr/share/maven2/repository</url>
+      <snapshots>
+        <enabled>true</enabled>
+      </snapshots>
+      <releases>
+        <updatePolicy>never</updatePolicy>
+      </releases>
+    </pluginRepository>
+
   </pluginRepositories>
 
   <build>
diff -up ./pom.xml.sav ./pom.xml
--- ./pom.xml.sav	2009-08-06 15:11:38.000000000 -0400
+++ ./pom.xml	2009-11-19 14:54:29.000000000 -0500
@@ -481,6 +481,11 @@ under the License.
         <artifactId>classworlds</artifactId>
         <version>1.1</version>
       </dependency>
+      <dependency>
+        <groupId>jdom</groupId>
+        <artifactId>jdom</artifactId>
+        <version>1.0</version>
+      </dependency>
     </dependencies>
     <!--start-->
   </dependencyManagement>

--- NEW FILE: maven2-antbuild.patch ---
diff -up ./build.xml.sav ./build.xml
--- ./build.xml.sav	2009-08-06 15:11:38.000000000 -0400
+++ ./build.xml	2009-11-19 13:44:40.000000000 -0500
@@ -108,6 +108,9 @@ TODO:
        <localRepository path="${maven.repo.local}"/>
        <dependency groupId="org.codehaus.modello" artifactId="modello-maven-plugin" version="1.0"/>
        <dependency groupId="org.codehaus.modello" artifactId="modello-core" version="1.0"/>
+       <dependency groupId="org.codehaus.modello" artifactId="modello-plugin-java" version="1.0"/>
+       <dependency groupId="org.codehaus.modello" artifactId="modello-plugin-xpp3" version="1.0"/>
+       <dependency groupId="org.codehaus.plexus" artifactId="plexus-classworlds" version="1.2-alpha-9"/>
     </artifact:dependencies>
   </target>
 
@@ -195,10 +198,13 @@ TODO:
       <classpath refid="maven.classpath"/>
       <arg value="-e"/>
       <arg value="-B"/>
+      <arg value="-s"/>
+      <arg value="__M2_SETTINGS_FILE__"/>
       <arg value="clean"/>
       <arg value="install"/>
       <arg value="-Dmaven.repo.local=${maven.repo.local}"/>
       <arg value="-Dsurefire.useFile=${surefire.useFile}"/>
+      <arg value="-Dmaven2.jpp.mode=1"/>
     </java>
   </target>
 

--- NEW FILE: maven2-jpp-script ---
#!/bin/sh
if [ -f /usr/share/java-utils/java-functions ] ; then
  . /usr/share/java-utils/java-functions
  set_jvm
  set_javacmd
fi

export M2_HOME=/usr/share/maven2
echo $JAVA_HOME
export JAVA_HOME; $M2_HOME/bin/mvn -Dmaven2.jpp.mode $@

--- NEW FILE: maven2-2.2.1-settings.xml ---
<settings>
    <localRepository>__M2_LOCALREPO_PLACEHOLDER__</localRepository>
    <mirrors>
        <mirror>
            <id>RPMCentralRepoMirror</id>
            <name>RPM Central Repo Mirror</name>
            <url>__M2_REMOTEREPO_PLACEHOLDER__</url>
            <mirrorOf>central</mirrorOf>
        </mirror>
    </mirrors>

    <profiles>
        <profile>
            <id>build</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <repositories>
                <repository>
                    <id>RPMBuildRepo</id>
                    <name>Repo used during rpmbuild</name>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                        <checksumPolicy>warn</checksumPolicy>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                        <checksumPolicy>warn</checksumPolicy>
                    </snapshots>
                    <url>__M2_REMOTEREPO_PLACEHOLDER__</url>
                    <layout>default</layout>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <id>RPMPluginBuildRepo</id>
                    <name>Plugin repo used during rpmbuild</name>
                    <releases>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                        <checksumPolicy>warn</checksumPolicy>
                    </releases>
                    <snapshots>
                        <enabled>true</enabled>
                        <updatePolicy>never</updatePolicy>
                        <checksumPolicy>warn</checksumPolicy>
                    </snapshots>
                    <url>__M2_REMOTEREPO_PLACEHOLDER__</url>
                    <layout>default</layout>
                </pluginRepository>
            </pluginRepositories>
        </profile>
    </profiles>
</settings>

--- NEW FILE: maven22.spec ---
%global bootstrap 1
%global __jar_repack 0
%global majmin 22

Name:           maven22
Version:        2.2.1
Release:        23.1%{?dist}
Summary:        Java project management and project comprehension tool

Group:          Development/Build Tools
License:        ASL 2.0 and MIT and BSD
URL:            http://maven.apache.org

# export https://svn.apache.org/repos/asf/maven/maven-2/tags/maven-%{version}/ apache-maven-%{version}
# tar czvf maven2-%{version}.tar.gz apache-maven-%{version}
Source0:        maven2-%{version}.tar.gz

# Since we are using the entire dependency set "as is", we need to atleast try
# and make it so that only one version is packaged in the binary blob. This
# server an additional (and more important) purpose ... it ensures that a
# single version of each module is enough; because if not, versioned rpm names
# would be needed for those dependencies. The idea is as follows:

# Required by maven:
#  org/codehaus/plexus/1.0/plexus-1.0.jar
#  org/codehaus/plexus/1.1/plexus-1.1.jar
# What we package in the blob:
#  org/codehaus/plexus/1.1/plexus-1.1.jar
#  org/codehaus/plexus/1.0/plexus-1.0.jar -> ../1.1/plexus-1.1.jar

# Doing this for the hundreds of jars is a huge pain.. so we do the only
# thing sane people can. Crazy scripting magic! To generate the tarball

# rm -rf ~/.m2
# tar xzf SOURCE0
# cd apache-maven-%{version}
# export M2_HOME=`pwd`/installation/apache-maven-%{version}
# ant
# cd ~/.m2
# SOURCE100
# Find maven-%{version}-bootstrapdeps.tar.gz in ./
Source1:        maven2-%{version}-bootstrapdeps.tar.gz

# 1xx for non-upstream/created sources
Source100:      maven2-%{version}-settings.xml
Source101:      maven2-JPackageRepositoryLayout.java
Source102:      maven2-MavenJPackageDepmap.java
Source103:      maven2-%{version}-depmap.xml
Source104:      maven2-empty-dep.pom
Source105:      maven2-empty-dep.jar

# 2xx for created non-buildable sources
Source200:      maven2-script
Source201:      maven2-jpp-script

Patch0:         maven2-antbuild.patch
Patch1:         maven2-%{version}-jpp.patch
Patch2:         maven2-%{version}-update-tests.patch
Patch3:         maven2-%{version}-enable-bootstrap-repo.patch
Patch4:         maven2-%{version}-unshade.patch
Patch5:         maven2-%{version}-default-resolver-pool-size.patch
Patch6:         maven2-RELEASE.patch

BuildRequires:  java-devel >= 1.6.0
BuildRequires:  classworlds
BuildRequires:  jdom

%if %{bootstrap}
BuildRequires:  ant
BuildRequires:  zip
%else
BuildRequires:  maven2-common-poms
BuildRequires:  apache-resource-bundles
BuildRequires:  objectweb-asm
BuildRequires:  backport-util-concurrent
BuildRequires:  mojo-maven2-plugin-buildnumber
BuildRequires:  bsh
BuildRequires:  jsch
BuildRequires:  jakarta-commons-cli
BuildRequires:  jakarta-commons-codec
BuildRequires:  jakarta-commons-collections
BuildRequires:  jakarta-commons-httpclient
BuildRequires:  jakarta-commons-io
BuildRequires:  jakarta-commons-lang
BuildRequires:  jakarta-commons-logging
BuildRequires:  easymock
BuildRequires:  junit
BuildRequires:  nekohtml
BuildRequires:  ant
BuildRequires:  maven-doxia
BuildRequires:  jetty6
BuildRequires:  maven-archiver
BuildRequires:  maven-assembly-plugin
BuildRequires:  maven-doxia-tools
BuildRequires:  maven-enforcer-api
BuildRequires:  maven-enforcer-plugin
BuildRequires:  maven-enforcer-rules
BuildRequires:  maven-shade-plugin
BuildRequires:  maven-clean-plugin
BuildRequires:  maven-compiler-plugin
BuildRequires:  maven-resources-plugin
BuildRequires:  maven-install-plugin
BuildRequires:  maven-jar-plugin
BuildRequires:  maven-plugin-testing-harness
BuildRequires:  maven-pmd-plugin
BuildRequires:  maven-shared-file-management
BuildRequires:  maven-shared-common-artifact-filters
BuildRequires:  maven-shared-dependency-tree
BuildRequires:  maven-shared-repository-builder
BuildRequires:  maven-shared-io
BuildRequires:  maven-shared-downloader
BuildRequires:  maven-shared-filtering
BuildRequires:  maven-shared-reporting-api
BuildRequires:  maven-site-plugin
BuildRequires:  maven-surefire-maven-plugin
BuildRequires:  maven-surefire-provider-junit
BuildRequires:  maven-scm
BuildRequires:  maven-wagon
BuildRequires:  modello
BuildRequires:  multithreadedtc
BuildRequires:  oro
BuildRequires:  plexus-active-collections 
BuildRequires:  plexus-ant-factory 
BuildRequires:  plexus-archiver
BuildRequires:  plexus-cipher
BuildRequires:  plexus-bsh-factory
BuildRequires:  plexus-build-api
BuildRequires:  plexus-classworlds
BuildRequires:  plexus-compiler
BuildRequires:  plexus-component-api
BuildRequires:  plexus-containers-container-default
BuildRequires:  plexus-container-default
BuildRequires:  plexus-i18n
BuildRequires:  plexus-interactivity
BuildRequires:  plexus-interpolation
BuildRequires:  plexus-io
BuildRequires:  plexus-resources
BuildRequires:  plexus-sec-dispatcher
BuildRequires:  plexus-utils
BuildRequires:  plexus-velocity
BuildRequires:  regexp
BuildRequires:  forge-parent
BuildRequires:  spice-parent
BuildRequires:  jakarta-oro
BuildRequires:  regexp
# jar locations changed in slf4j-0:1.6.1
BuildRequires:  slf4j < 0:1.6.1
BuildRequires:  velocity
%endif

Requires:       classworlds
Requires:       jdom

%if !%{bootstrap}
Requires:       apache-resource-bundles
Requires:       objectweb-asm
Requires:       backport-util-concurrent
Requires:       bsh
Requires:       jsch
Requires:       jakarta-commons-cli
Requires:       jakarta-commons-codec
Requires:       jakarta-commons-collections
Requires:       jakarta-commons-httpclient
Requires:       jakarta-commons-io
Requires:       jakarta-commons-lang
Requires:       jakarta-commons-logging
#Requires:      apache-commons-parent
Requires:       easymock
Requires:       junit
Requires:       nekohtml
Requires:       ant
Requires:       maven-doxia
Requires:       jetty6
Requires:       maven-archiver
Requires:       maven-doxia-tools
Requires:       maven-enforcer-api
Requires:       maven-enforcer-plugin
Requires:       maven-plugin-testing-harness
Requires:       maven-shared-file-management
Requires:       maven-shared-common-artifact-filters
Requires:       maven-shared-dependency-tree
Requires:       maven-shared-repository-builder
Requires:       maven-shared-io
Requires:       maven-shared-downloader
Requires:       maven-shared-filtering
Requires:       maven-shared-reporting-api
Requires:       maven-surefire-provider-junit
Requires:       maven-scm
Requires:       maven-wagon
Requires:       maven2-common-poms
Requires:       modello
Requires:       multithreadedtc
Requires:       jakarta-oro
Requires:       plexus-active-collections
Requires:       plexus-ant-factory
Requires:       plexus-archiver
Requires:       plexus-cipher
Requires:       plexus-bsh-factory
Requires:       plexus-build-api
Requires:       plexus-classworlds
Requires:       plexus-compiler
Requires:       plexus-component-api
Requires:       plexus-containers-container-default
Requires:       plexus-container-default
Requires:       plexus-i18n
Requires:       plexus-interactivity
Requires:       plexus-interpolation
Requires:       plexus-io
Requires:       plexus-resources
Requires:       plexus-sec-dispatcher
Requires:       plexus-utils
Requires:       plexus-velocity
Requires:       regexp
Requires:       forge-parent
Requires:       spice-parent
Requires:       jakarta-oro
Requires:       regexp
Requires:       slf4j
Requires:       velocity
%endif

Requires(post): jpackage-utils
Requires(postun): jpackage-utils
Requires:       jpackage-utils

BuildArch:      noarch

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root

%description
Apache Maven is a software project management and comprehension tool. Based on
the concept of a project object model (POM), Maven can manage a project's
build, reporting and documentation from a central piece of information.

%prep
%setup -q -n apache-maven-%{version}

%patch0 -p0 -b .antbuild
%patch1 -p0 -b .jpp
%patch2 -p0 -b .update-tests
%patch6 -p0 -b .release

%if ! %{bootstrap}
%patch4 -p0 -b .unshade
%endif

%if %{bootstrap}
%patch3 -p0 -b .enable-bootstrap-repo
%endif

# set cache location
export M2_REPO=`pwd`/.m2
mkdir $M2_REPO

# if bootstrapping, extract the dependencies
%if %{bootstrap}
(cd $M2_REPO

  tar xzf %{SOURCE1}

  # maven-remote-resources-plugin (m-r-r-p) is used side-by-side with
  # plexus-velocity (p-v) 1.1.3 upstream.. we collapse to a single p-v version
  # of 1.1.7. 1.1.7 however has a component descriptor that conflicts
  # with the one in m-r-r-p. We therefore need to remove the descriptor
  # from m-r-r-p first
  zip -d repository/org/apache/maven/plugins/maven-remote-resources-plugin/1.0-beta-2/maven-remote-resources-plugin-1.0-beta-2.jar \
         META-INF/plexus/components.xml

  # resource bundle 1.3 is needed during build, but not when done via
  # upstream, for some reason
  mkdir -p repository/org/apache/apache-jar-resource-bundle/1.3
  ln -s ../1.4/apache-jar-resource-bundle-1.4.jar \
        repository/org/apache/apache-jar-resource-bundle/1.3/apache-jar-resource-bundle-1.3.jar
  ln -s ../1.4/apache-jar-resource-bundle-1.4.jar.sha1 \
        repository/org/apache/apache-jar-resource-bundle/1.3/apache-jar-resource-bundle-1.3.jar.sha1
)
%endif

cp %{SOURCE101} maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/JPackageRepositoryLayout.java
cp %{SOURCE102} maven-artifact/src/main/java/org/apache/maven/artifact/repository/layout/MavenJPackageDepmap.java

# disable parallel artifact resolution
%patch5 -p1 -b .parallel-artifacts-resolution

# test case is incorrectly assuming that target executed by antcall
# can propagate references to its parent (stopped working with ant 1.8)
rm maven-script/maven-script-ant/src/test/java/org/apache/maven/script/ant/AntMojoWrapperTest.java

# FIXIT: look why these tests are failing with maven-surefire 2.6
rm maven-artifact/src/test/java/org/apache/maven/artifact/resolver/DefaultArtifactCollectorTest.java
rm maven-project/src/test/java/org/apache/maven/project/validation/DefaultModelValidatorTest.java

%build
export M2_REPO=`pwd`/.m2
export M2_HOME=`pwd`/installation/apache-maven-%{version}

# copy settings to where ant reads from
mkdir -p $M2_HOME/conf
cp %{SOURCE100} $M2_HOME/conf/settings.xml

# replace locations in the copied settings file
sed -i -e s:__M2_LOCALREPO_PLACEHOLDER__:"file\://$M2_REPO/cache":g $M2_HOME/conf/settings.xml
sed -i -e s:__M2_REMOTEREPO_PLACEHOLDER__:"file\://$M2_REPO/repository":g $M2_HOME/conf/settings.xml

# replace settings file location before patching
sed -i -s s:__M2_SETTINGS_FILE__:$M2_HOME/conf/settings.xml:g build.xml

%if %{bootstrap}
ant -Dmaven.repo.local=$M2_REPO/cache
%else
# FIXME: These tests fail when building with maven for an unknown reason
rm -f maven-core/src/test/java/org/apache/maven/WagonSelectorTest.java
rm -f maven-artifact-manager/src/test/java/org/apache/maven/artifact/manager/DefaultWagonManagerTest.java
mvn-jpp -P all-models -Dmaven.repo.local=$M2_REPO/cache -Dmaven2.jpp.depmap.file=%{SOURCE103} install
%endif

%install
rm -rf $RPM_BUILD_ROOT

export M2_HOME=$(pwd)/installation/apache-maven-%{version}

rm -rf $M2_HOME

mkdir -p $(pwd)/installation/
(cd $(pwd)/installation/
tar jxf ../apache-maven/target/*bz2
)

# maven2 directory in /usr/share/java
install -dm 755 $RPM_BUILD_ROOT%{_javadir}/%{name}

###########
# M2_HOME #
###########
install -dm 755 $RPM_BUILD_ROOT%{_datadir}/%{name}

###############
# M2_HOME/bin #
###############
install -dm 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/bin
cp -a $M2_HOME/bin/* $RPM_BUILD_ROOT%{_datadir}/%{name}/bin

# Remove unnecessary batch scripts
rm -f $RPM_BUILD_ROOT%{_datadir}/%{name}/bin/*.bat

# Update conf file for unversioned jar names
sed -i -e s:'-classpath "${M2_HOME}"/boot/classworlds-\*.jar':'-classpath "${M2_HOME}"/boot/classworlds.jar':g \
        $RPM_BUILD_ROOT%{_datadir}/%{name}/bin/mvn $RPM_BUILD_ROOT%{_datadir}/%{name}/bin/mvnDebug

################
# M2_HOME/boot #
################
install -dm 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/boot
%if %{bootstrap}
cp -a $M2_HOME/boot/* $RPM_BUILD_ROOT%{_datadir}/%{name}/boot/
%endif

################
# M2_HOME/conf #
################
install -dm 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/conf
cp -a $M2_HOME/conf/* $RPM_BUILD_ROOT%{_datadir}/%{name}/conf/

###############
# M2_HOME/lib #
###############
install -dm 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/lib

install -p -m 644 $M2_HOME/lib/maven-%{version}-uber.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/uber-%{version}.jar
ln -s uber-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/uber.jar
ln -s %{_javadir}/%{name}/uber.jar $RPM_BUILD_ROOT%{_datadir}/%{name}/lib/maven-%{version}-uber.jar

################
# M2_HOME/poms #
#*##############
install -dm 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/poms

########################
# /etc/maven/fragments #
########################
install -dm 755 $RPM_BUILD_ROOT/%{_sysconfdir}/maven/fragments

##############################
# /usr/share/java repository #
##############################
install -dm 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/repository
ln -s %{_javadir} $RPM_BUILD_ROOT%{_datadir}/%{name}/repository/JPP
install -dm 755 $RPM_BUILD_ROOT%{_datadir}/%{name}/repository-signed
ln -s %{_javadir}-signed $RPM_BUILD_ROOT%{_datadir}/%{name}/repository-signed/JPP

##################
# javadir/maven2 #
#*################
install -dm 755 $RPM_BUILD_ROOT%{_javadir}/%{name}

#######################
# javadir/maven2/poms #
#*#####################
ln -s %{_datadir}/%{name}/poms $RPM_BUILD_ROOT%{_javadir}/%{name}/poms

############
# /usr/bin #
############
install -dm 755 $RPM_BUILD_ROOT%{_bindir}

# Install files
install -m 644 %{SOURCE104} $RPM_BUILD_ROOT%{_datadir}/%{name}/poms/JPP.maven2-empty-dep.pom
install -m 644 %{SOURCE105} $RPM_BUILD_ROOT%{_javadir}/%{name}/empty-dep.jar

# Wrappers
/bin/cp -af %{SOURCE200} $RPM_BUILD_ROOT%{_bindir}/mvn%{majmin}
/bin/cp -af %{SOURCE201} $RPM_BUILD_ROOT%{_bindir}/mvn%{majmin}-jpp

%if %{bootstrap}
    cp -af `pwd`/.m2/repository $RPM_BUILD_ROOT%{_datadir}/%{name}/bootstrap_repo
%endif

###################
# Individual jars #
###################

for file in \
    maven-script/maven-script-ant/target/maven-script-ant-%{version}.jar \
    maven-script/maven-script-beanshell/target/maven-script-beanshell-%{version}.jar \
    apache-maven/target/apache-maven-%{version}.jar \
    maven-profile/target/maven-profile-%{version}.jar \
    maven-artifact-manager/target/maven-artifact-manager-%{version}.jar \
    maven-artifact-test/target/maven-artifact-test-%{version}.jar \
    maven-monitor/target/maven-monitor-%{version}.jar \
    maven-toolchain/target/maven-toolchain-%{version}.jar \
    maven-toolchain/target/original-maven-toolchain-%{version}.jar \
    maven-project/target/maven-project-%{version}.jar \
    maven-settings/target/maven-settings-%{version}.jar \
    maven-plugin-parameter-documenter/target/maven-plugin-parameter-documenter-%{version}.jar \
    maven-model/target/maven-model-%{version}.jar \
    maven-artifact/target/maven-artifact-%{version}.jar \
    maven-repository-metadata/target/maven-repository-metadata-%{version}.jar \
    maven-plugin-api/target/maven-plugin-api-%{version}.jar \
    maven-error-diagnostics/target/maven-error-diagnostics-%{version}.jar \
    maven-compat/target/maven-compat-%{version}.jar \
    maven-core/target/maven-core-%{version}.jar \
    maven-plugin-registry/target/maven-plugin-registry-%{version}.jar \
    maven-plugin-descriptor/target/maven-plugin-descriptor-%{version}.jar; do \

        FNAME=`basename $file`
        FNAME_NO_EXT=`basename $file .jar`
        DIR=`dirname $file`
        UNVER_NAME=`basename $file | sed -e s:-%{version}::g`
        UNVER_NAME_WITH_NO_EXT=`echo $FNAME_NO_EXT | sed -e s:-%{version}::g`
        ARTIFACT=`basename \`dirname $DIR\``


        pushd $DIR
          install -m 644 $FNAME $RPM_BUILD_ROOT%{_javadir}/%{name}/
          ln -s $FNAME $RPM_BUILD_ROOT%{_javadir}/%{name}/$UNVER_NAME
          install -m 644 ../pom.xml $RPM_BUILD_ROOT%{_datadir}/%{name}/poms/JPP.%{name}-$UNVER_NAME_WITH_NO_EXT.pom
          %add_to_maven_depmap org.apache.maven $ARTIFACT %{version} JPP/%{name} $UNVER_NAME_WITH_NO_EXT
        popd
done

# maven-reporting-api
install -m 644  maven-reporting/maven-reporting-api/target/maven-reporting-api-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/
ln -s maven-reporting-api-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/maven-reporting-api.jar
install -m 644 maven-reporting/maven-reporting-api/pom.xml $RPM_BUILD_ROOT%{_datadir}/%{name}/poms/JPP.%{name}-maven-reporting-api.pom
%add_to_maven_depmap org.apache.maven.reporting maven-reporting-api %{version} JPP/%{name} maven-reporting-api

# maven-reporting pom
install -m 644 maven-reporting/pom.xml $RPM_BUILD_ROOT%{_datadir}/%{name}/poms/JPP.%{name}-maven-reporting.pom
%add_to_maven_depmap org.apache.maven.reporting maven-reporting %{version} JPP/%{name} maven-reporting

# maven pom
install -m 644 pom.xml $RPM_BUILD_ROOT%{_datadir}/%{name}/poms/JPP.%{name}-maven.pom
%add_to_maven_depmap org.apache.maven maven %{version} JPP/%{name} maven

(cd %{buildroot}%{_datadir}/%{name}/lib
  %{__ln_s} `build-classpath jdom` jdom.jar
)

(cd %{buildroot}%{_datadir}/%{name}/boot
  %{__rm} classworlds-1.1.jar
  %{__ln_s} `build-classpath classworlds` classworlds.jar
)

%if ! %{bootstrap}
(cd %{buildroot}%{_datadir}/%{name}/lib
  for i in backport-util-concurrent jsch commons-cli commons-httpclient commons-codec nekohtml maven-shared/reporting-api maven-doxia/logging-api maven-doxia/sink-api \
maven-wagon/file maven-wagon/http maven-wagon/http-lightweight maven-wagon/http-shared maven-wagon/provider-api maven-wagon/ssh maven-wagon/ssh-common maven-wagon/ssh-external plexus/container-default \
plexus/interactivity-api plexus/interpolation plexus/utils slf4j/api slf4j/nop plexus/plexus-cipher plexus/plexus-sec-dispatcher xerces-j2; do %{__ln_s} `build-classpath ${i}`; done
)
%endif

%post
%update_maven_depmap

%postun
%update_maven_depmap

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%attr(0755,root,root) %{_bindir}/mvn%{majmin}
%attr(0755,root,root) %{_bindir}/mvn%{majmin}-jpp
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/bin
%config(noreplace) %{_datadir}/%{name}/bin/*.conf
%attr(0755,root,root) %{_datadir}/%{name}/bin/mvn
%attr(0755,root,root) %{_datadir}/%{name}/bin/mvnDebug
%dir %{_datadir}/%{name}/boot
%{_datadir}/%{name}/boot/classworlds.jar
%dir %{_datadir}/%{name}/conf
# XXX: should this be in %%{_sysconfdir} and marked as %%config
%{_datadir}/%{name}/conf/settings.xml
%{_javadir}/%{name}/apache-maven-%{version}.jar
%{_javadir}/%{name}/apache-maven.jar
%{_javadir}/%{name}/empty-dep.jar
%{_javadir}/%{name}/maven-artifact-%{version}.jar
%{_javadir}/%{name}/maven-artifact-manager-%{version}.jar
%{_javadir}/%{name}/maven-artifact-manager.jar
%{_javadir}/%{name}/maven-artifact-test-%{version}.jar
%{_javadir}/%{name}/maven-artifact-test.jar
%{_javadir}/%{name}/maven-artifact.jar
%{_javadir}/%{name}/maven-compat-%{version}.jar
%{_javadir}/%{name}/maven-compat.jar
%{_javadir}/%{name}/maven-core-%{version}.jar
%{_javadir}/%{name}/maven-core.jar
%{_javadir}/%{name}/maven-error-diagnostics-%{version}.jar
%{_javadir}/%{name}/maven-error-diagnostics.jar
%{_javadir}/%{name}/maven-model-%{version}.jar
%{_javadir}/%{name}/maven-model.jar
%{_javadir}/%{name}/maven-monitor-%{version}.jar
%{_javadir}/%{name}/maven-monitor.jar
%{_javadir}/%{name}/maven-plugin-api-%{version}.jar
%{_javadir}/%{name}/maven-plugin-api.jar
%{_javadir}/%{name}/maven-plugin-descriptor-%{version}.jar
%{_javadir}/%{name}/maven-plugin-descriptor.jar
%{_javadir}/%{name}/maven-plugin-parameter-documenter-%{version}.jar
%{_javadir}/%{name}/maven-plugin-parameter-documenter.jar
%{_javadir}/%{name}/maven-plugin-registry-%{version}.jar
%{_javadir}/%{name}/maven-plugin-registry.jar
%{_javadir}/%{name}/maven-profile-%{version}.jar
%{_javadir}/%{name}/maven-profile.jar
%{_javadir}/%{name}/maven-project-%{version}.jar
%{_javadir}/%{name}/maven-project.jar
%{_javadir}/%{name}/maven-reporting-api-%{version}.jar
%{_javadir}/%{name}/maven-reporting-api.jar
%{_javadir}/%{name}/maven-repository-metadata-%{version}.jar
%{_javadir}/%{name}/maven-repository-metadata.jar
%{_javadir}/%{name}/maven-script-ant-%{version}.jar
%{_javadir}/%{name}/maven-script-ant.jar
%{_javadir}/%{name}/maven-script-beanshell-%{version}.jar
%{_javadir}/%{name}/maven-script-beanshell.jar
%{_javadir}/%{name}/maven-settings-%{version}.jar
%{_javadir}/%{name}/maven-settings.jar
%{_javadir}/%{name}/maven-toolchain-%{version}.jar
%{_javadir}/%{name}/maven-toolchain.jar
%{_javadir}/%{name}/original-maven-toolchain-%{version}.jar
%{_javadir}/%{name}/original-maven-toolchain.jar
%dir %{_javadir}/%{name}/poms
%{_javadir}/%{name}/uber-%{version}.jar
%{_javadir}/%{name}/uber.jar
%dir %{_datadir}/%{name}/lib
%{_datadir}/%{name}/lib/jdom.jar
%if !%{bootstrap}
%{_datadir}/%{name}/lib/backport-util-concurrent.jar
%{_datadir}/%{name}/lib/commons-cli.jar
%{_datadir}/%{name}/lib/commons-codec.jar
%{_datadir}/%{name}/lib/commons-httpclient.jar
%{_datadir}/%{name}/lib/jsch.jar
%{_datadir}/%{name}/lib/maven-doxia_logging-api.jar
%{_datadir}/%{name}/lib/maven-doxia_sink-api.jar
%{_datadir}/%{name}/lib/maven-shared_reporting-api.jar
%{_datadir}/%{name}/lib/maven-wagon_file.jar
%{_datadir}/%{name}/lib/maven-wagon_http-lightweight.jar
%{_datadir}/%{name}/lib/maven-wagon_http-shared.jar
%{_datadir}/%{name}/lib/maven-wagon_http.jar
%{_datadir}/%{name}/lib/maven-wagon_provider-api.jar
%{_datadir}/%{name}/lib/maven-wagon_ssh-common.jar
%{_datadir}/%{name}/lib/maven-wagon_ssh-external.jar
%{_datadir}/%{name}/lib/maven-wagon_ssh.jar
%{_datadir}/%{name}/lib/nekohtml.jar
%{_datadir}/%{name}/lib/plexus_container-default.jar
%{_datadir}/%{name}/lib/plexus_interactivity-api.jar
%{_datadir}/%{name}/lib/plexus_interpolation.jar
%{_datadir}/%{name}/lib/plexus_plexus-cipher.jar
%{_datadir}/%{name}/lib/plexus_plexus-sec-dispatcher.jar
%{_datadir}/%{name}/lib/plexus_utils.jar
%{_datadir}/%{name}/lib/slf4j_api.jar
%{_datadir}/%{name}/lib/slf4j_nop.jar
%{_datadir}/%{name}/lib/xerces-j2.jar
%endif
%{_datadir}/%{name}/lib/maven-%{version}-uber.jar
%{_datadir}/%{name}/poms
%{_datadir}/%{name}/repository
%{_datadir}/%{name}/repository-signed
%{_mavendepmapfragdir}/%{name}
%dir %{_javadir}/%{name}
%if %{bootstrap}
%{_datadir}/%{name}/bootstrap_repo
%endif
%doc

%changelog
* Mon Oct 10 2011 David Walluck <dwalluck at redhat.com> 2.2.1-23.1
- enable bootstrap
- BuildRequires: zip in bootstrap mode
- fix patch macros (for mdv)
- switch some build-jar-repository calls to build-classpath calls
- fix file list in bootstrap mode
- remove versioned classworlds-1.1.jar

* Mon Jul 18 2011 David Walluck <dwalluck at redhat.com> 2.2.1-23
- add missing org.apache.maven:maven-artifact-test

* Wed Feb 09 2011 David Walluck <dwalluck at redhat.com> 2.2.1-22
- own symlinks
- don't create symlinks outside of %%install
- use %%{_bindir} macro
- only use slf4j api and nop (drop jcl-over-slf4j and jdk14)

* Wed Dec 15 2010 David Walluck <dwalluck at redhat.com> 2.2.1-21
- add back Requires: maven2-common-poms

* Tue Dec 14 2010 David Walluck <dwalluck at redhat.com> 2.2.1-20
- partially merge with 2.2.1-16
- add Requires on jpackage-utils
- FIXME: unowned files due to post and preun build-jar-repository

* Thu Oct 28 2010 Fernando Nasser <fnasser at redhat.com> - 2.2.1-19
- Create repository-signed

* Wed Oct 27 2010 Fernando Nasser <fnasser at redhat.com> - 2.2.1-18
- Add __jpps_repo__ repository for signed JARs, located in
  /usr/share/maven2/repository-signed

* Fri Oct 22 2010 Fernando Nasser <fnasser at redhat.com> - 2.2.1-17
- Use full path to build-jar-repository in post (mock problem?)

* Fri Oct 22 2010 Fernando Nasser <fnasser at redhat.com> - 2.2.1-16
- Requires jpp-utils on post as we use build-jar-repository

* Fri Oct 22 2010 Fernando Nasser <fnasser at redhat.com> - 2.2.1-15
- Adds (post) to jdom and classworlds (missing from last release fix)
- Backport fix from Deepak Bhole created for our 2.0.8 version:
  Handle RELEASE version strings properly

* Fri Oct 22 2010 Fernando Nasser <fnasser at redhat.com> - 2.2.1-14
- Re-add backport-util-concurrent

* Fri Oct 22 2010 Fernando Nasser <fnasser at redhat.com> - 2.2.1-13
- Remove backport-util-concurrent not necesary with JDK 1.5 onwards
- Make sure all packages used in post are Required(post)

* Wed Oct 20 2010 Hui Wang <huwang at redhat.com> - 2.2.1-12
- Add Requires: maven2-common-poms
- Add jpp depmap entry of plexus-container-default

* Tue Oct 19 2010 Fernando Nasser <fnasser at redhat.com> - 2.2.1-11
- Backport fixes from Deepak Bhole created for our 2.0.8 version:
  Honour the classifier field in the pom
  Handle artifacts other than just poms and jars

* Sun Sep 19 2010 Hui Wang <huwang at redhat.com> - 2.2.1-10
- Change BR maven-enforcer-rule-api to maven-enforcer-rules
- Add BR maven2-common-poms
- Add -P all-models to generate maven model v3

* Mon Aug 30 2010 Hui Wang <huwang at redhat.com> - 2.2.1-9
- Change jetty requires to jetty6

* Mon Aug 30 2010 Hui Wang <huwang at redhat.com> - 2.2.1-8
- Comment jna and svnkit requirements out
- Change BR maven-plugin-shade to maven-shade-plugin
- Change BR buildnumber-plugin-maven to mojo-maven2-plugin-buildnumber
- Add jdom jpp depmap

* Tue Jun 29 2010 Stanislav Ochotnicky <sochotnicky at redhat.com> - 2.2.1-7
- Updated previous patch to only modify behaviour in JPP mode

* Mon Jun 28 2010 Stanislav Ochotnicky <sochotnicky at redhat.com> - 2.2.1-6
- Disable parallel artifact resolution

* Wed Jun 23 2010 Yong Yang <yyang at redhat.com> 2.2.1-5
- Add Requires: maven-enforcer-plugin

* Fri Jun 18 2010 Deepak Bhole <dbhole at redhat.com> 2.2.1-4
- Final non-bootstrap build against non-bootstrap maven

* Fri Jun 18 2010 Deepak Bhole <dbhole at redhat.com> 2.2.1-3
- Added buildnumber plugin requirements
- Rebuild in non-bootstrap

* Thu Jun 17 2010 Deepak Bhole <dbhole at redhat.com> - 0:2.2.1-2
- Added support for dumping mapping info (in debug mode)
- Add a custom depmap
- Added empty-dep
- Added proper requirements
- Fixed classworlds jar name used at runtime
- Install individual components
- Install poms and mappings
- Remove non maven items from shaded uber jar
- Create dependency links in $M2_HOME/lib at install time

* Thu Nov 26 2009 Deepak Bhole <dbhole at redhat.com> - 0:2.2.1-1
- Initial bootstrap build

Index: sources
===================================================================
RCS file: /home/projects/jpackage/cvs/dist/maven22/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -d -r1.1 -r1.2
*** sources	11 Oct 2011 20:09:26 -0000	1.1
--- sources	11 Oct 2011 20:23:31 -0000	1.2
***************
*** 0 ****
--- 1,3 ----
+ 6f46b0e42921df6a9b1a8280d59ab80b  maven2-2.2.1-bootstrapdeps.tar.gz
+ 1197900ced670d0a62211f67aa8a3b68  maven2-2.2.1.tar.gz
+ dc36ce1fbefedbdd27fa93c8584ba91a  maven2-empty-dep.jar

--- NEW FILE: maven2-empty-dep.pom ---
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>JPP/maven2</groupId>
  <artifactId>empty-dep</artifactId>
  <version>2.0.4</version>
  <name>Empty dependency</name>
  <description>This is an empty dependency. For use in jpp mode when one or more dependencies need elimination.</description>
</project>

--- NEW FILE: maven2-2.2.1-unshade.patch ---
diff -up ./apache-maven/pom.xml.sav ./apache-maven/pom.xml
--- ./apache-maven/pom.xml.sav	2009-08-06 15:11:25.000000000 -0400
+++ ./apache-maven/pom.xml	2010-06-15 16:21:15.000000000 -0400
@@ -71,53 +71,40 @@
                   <exclude>xml-apis:xml-apis</exclude>
                   <exclude>junit:junit</exclude>
                   <exclude>jmock:jmock</exclude>
+                  <exclude>backport-util-concurrent:backport-util-concurrent</exclude>
+                  <exclude>com.jcraft:jsch</exclude>
+                  <exclude>commons-cli:commons-cli</exclude>
+                  <exclude>commons-codec:commons-codec:jar</exclude>
+                  <exclude>commons-httpclient:commons-httpclient:jar</exclude>
+                  <exclude>jdom:jdom</exclude>
+                  <exclude>nekohtml:nekohtml</exclude>
+                  <exclude>nekohtml:xercesMinimal</exclude>
+                  <exclude>org.apache.maven.doxia:doxia-logging-api</exclude>
+                  <exclude>org.apache.maven.doxia:doxia-sink-api</exclude>
+                  <exclude>org.apache.maven.wagon:wagon-file</exclude>
+                  <exclude>org.apache.maven.wagon:wagon-http</exclude>
+                  <exclude>org.apache.maven.wagon:wagon-http-lightweight</exclude>
+                  <exclude>org.apache.maven.wagon:wagon-http-shared</exclude>
+                  <exclude>org.apache.maven.wagon:wagon-provider-api</exclude>
+                  <exclude>org.apache.maven.wagon:wagon-ssh</exclude>
+                  <exclude>org.apache.maven.wagon:wagon-ssh-common</exclude>
+                  <exclude>org.apache.maven.wagon:wagon-ssh-external</exclude>
+                  <exclude>org.apache.maven.wagon:wagon-webdav-jackrabbit</exclude>
+                  <exclude>org.apache.jackrabbit:jackrabbit-webdav</exclude>
+                  <exclude>org.apache.jackrabbit:jackrabbit-jcr-commons</exclude>
+                  <exclude>org.codehaus.plexus:plexus-container-default</exclude>
+                  <exclude>org.codehaus.plexus:plexus-interactivity-api</exclude>
+                  <exclude>org.codehaus.plexus:plexus-interpolation</exclude>
+                  <exclude>org.codehaus.plexus:plexus-sec-dispatcher</exclude>
+                  <exclude>org.codehaus.plexus:plexus-utils</exclude>
+                  <exclude>org.slf4j:jcl-over-slf4j</exclude>
+                  <exclude>org.slf4j:slf4j-api</exclude>
+                  <exclude>org.slf4j:slf4j-nop</exclude>
+                  <exclude>org.slf4j:slf4j-jdk14</exclude>
+                  <exclude>org.sonatype.plexus:plexus-cipher</exclude>
+                  <exclude>xerces:xerces</exclude>
                 </excludes>
               </artifactSet>
-              <relocations>
-                <!-- for jackrabbit webdav wagon -->
-                <relocation>
-                  <pattern>org.apache.jackrabbit</pattern>
-                </relocation>
-
-                <!-- For http/webdav wagons -->
-                <relocation>
-                  <pattern>org.apache.commons.httpclient</pattern>
-                </relocation>
-                <relocation>
-                  <pattern>org.apache.commons.logging</pattern>
-                </relocation>
-                <relocation>
-                  <pattern>org.slf4j</pattern>
-                </relocation>
-
-                <!-- For maven-artifact-manager -->
-                <relocation>
-                  <pattern>edu.emory.mathcs.backport</pattern>
-                </relocation>
-
-                <!-- For jsch wagon -->
-                <relocation>
-                  <pattern>org.apache.commons.codec</pattern>
-                </relocation>
-
-                <!-- For wagon API -->
-                <relocation>
-                  <pattern>org.cyberneko</pattern>
-                </relocation>
-                <relocation>
-                  <pattern>org.apache.xerces</pattern>
-                </relocation>
-
-                <relocation>
-                  <pattern>org.codehaus.plexus.util</pattern>
-                  <excludes>
-                    <exclude>org.codehaus.plexus.util.xml.Xpp3Dom</exclude>
-                    <exclude>org.codehaus.plexus.util.xml.pull.XmlPullParser</exclude>
-                    <exclude>org.codehaus.plexus.util.xml.pull.XmlPullParserException</exclude>
-                    <exclude>org.codehaus.plexus.util.xml.pull.XmlSerializer</exclude>
-                  </excludes>
-                </relocation>
-              </relocations>
             </configuration>
           </execution>
         </executions>

--- NEW FILE: maven2-2.2.1-depmap.xml ---
<dependencies>
    <dependency>
        <maven>
            <groupId>asm</groupId>
            <artifactId>asm</artifactId>
        </maven>
        <jpp>
            <groupId>JPP/objectweb-asm</groupId>
            <artifactId>asm</artifactId>
        </jpp>
    </dependency>
    <dependency>
        <maven>
            <groupId>asm</groupId>
            <artifactId>asm-commons</artifactId>
        </maven>
        <jpp>
            <groupId>JPP/objectweb-asm</groupId>
            <artifactId>asm-commons</artifactId>
        </jpp>
    </dependency>
    <dependency>
        <maven>
            <groupId>asm</groupId>
            <artifactId>asm-tree</artifactId>
        </maven>
        <jpp>
            <groupId>JPP/objectweb-asm</groupId>
            <artifactId>asm-tree</artifactId>
        </jpp>
    </dependency>
    <dependency>
        <maven>
            <groupId>asm</groupId>
            <artifactId>asm-util</artifactId>
        </maven>
        <jpp>
            <groupId>JPP/objectweb-asm</groupId>
            <artifactId>asm-util</artifactId>
        </jpp>
    </dependency>
    <dependency>
        <maven>
            <groupId>nekohtml</groupId>
            <artifactId>xercesMinimal</artifactId>
        </maven>
        <jpp>
            <groupId>JPP</groupId>
            <artifactId>xerces-j2</artifactId>
        </jpp>
    </dependency>
    <dependency>
        <maven>
            <groupId>org.tmatesoft.svnkit</groupId>
            <artifactId>svnkit</artifactId>
        </maven>
        <jpp>
            <groupId>JPP</groupId>
            <artifactId>svnkit</artifactId>
        </jpp>
    </dependency>

    <dependency>
        <maven>
            <groupId>net.java.dev.jna</groupId>
            <artifactId>jna</artifactId>
        </maven>
        <jpp>
            <groupId>JPP</groupId>
            <artifactId>jna</artifactId>
        </jpp>
    </dependency>
    
    <dependency>
        <maven>
            <groupId>org.jdom</groupId>
            <artifactId>jdom</artifactId>
        </maven>
        <jpp>
            <groupId>JPP</groupId>
            <artifactId>jdom</artifactId>
        </jpp>
    </dependency>

	<dependency>
        <maven>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-container-default</artifactId>
        </maven>
        <jpp>
            <groupId>JPP/plexus</groupId>
            <artifactId>container-default</artifactId>
        </jpp>
    </dependency>
</dependencies>

--- NEW FILE: maven2-2.2.1-default-resolver-pool-size.patch ---
>From 9c7b1812cbca35f8bd9997e6b5e3ce93f3191840 Mon Sep 17 00:00:00 2001
From: Stanislav Ochotnicky <sochotnicky at redhat.com>
Date: Mon, 28 Jun 2010 15:39:30 +0200
Subject: [PATCH] change default resolver pool size in jpp mode

---
 .../artifact/resolver/DefaultArtifactResolver.java |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java b/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
index d8c3629..0c40881 100644
--- a/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
+++ b/maven-artifact-manager/src/main/java/org/apache/maven/artifact/resolver/DefaultArtifactResolver.java
@@ -61,7 +61,14 @@ public class DefaultArtifactResolver
     // Components
     // ----------------------------------------------------------------------
 
-    private static final int DEFAULT_POOL_SIZE = 5;
+    private static final int DEFAULT_POOL_SIZE;
+    static {
+        if (System.getProperty("maven2.jpp.mode") == null) {
+            DEFAULT_POOL_SIZE = 5;
+        } else {
+            DEFAULT_POOL_SIZE = 1;
+        }
+    }
 
     private WagonManager wagonManager;
 
-- 
1.7.0.1


--- NEW FILE: maven2-MavenJPackageDepmap.java ---
package org.apache.maven.artifact.repository.layout;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.xml.sax.InputSource;

public class MavenJPackageDepmap {

	private static  MavenJPackageDepmap instance;
	private static Hashtable jppArtifactMap;

	private MavenJPackageDepmap() {
		jppArtifactMap = new Hashtable();
		buildJppArtifactMap();
	}
	
	public static MavenJPackageDepmap getInstance() {
		if (instance == null) {
			instance = new MavenJPackageDepmap();
		}
		
		return instance;
	}

	public Hashtable getMappedInfo(Hashtable mavenDep) {
		return getMappedInfo((String) mavenDep.get("group"), 
							(String) mavenDep.get("artifact"), 
							(String) mavenDep.get("version"));
	}

	public Hashtable getMappedInfo(String groupId, String artifactId, String version) {

		Hashtable jppDep;
		String idToCheck, jppCombination;

		if (System.getProperty("maven2.ignore.versions") == null && System.getProperty("maven2.jpp.mode") == null) {
			idToCheck = groupId+","+artifactId+","+version;
		} else {
			idToCheck = groupId+","+artifactId;
		}

		jppCombination = (String) jppArtifactMap.get(idToCheck);

		//System.err.println("*** " + groupId+","+artifactId+","+version + " => " + jppCombination);
		
		jppDep = new Hashtable();
		if (jppCombination != null && jppCombination != "") {

			StringTokenizer st = new StringTokenizer(jppCombination, ",");

			jppDep.put("group", st.nextToken());
			jppDep.put("artifact",st.nextToken());
			jppDep.put("version",st.nextToken());

		} else {
			jppDep.put("group", groupId);
			jppDep.put("artifact", artifactId);
			jppDep.put("version", version);
		}

		return jppDep;
	}


	/**
	 *	Returns whether or not the given dependency should be dropped.
	 */
	public boolean shouldEliminate(String groupId, String artifactId, String version) {
		String idToCheck;

		if (System.getProperty("maven2.ignore.versions") == null && System.getProperty("maven2.jpp.mode") == null) {
			idToCheck = groupId+","+artifactId+","+version;
		} else {
			idToCheck = groupId+","+artifactId;
		}

		return jppArtifactMap.get(idToCheck) != null && jppArtifactMap.get(idToCheck).equals("");

	}

	private static void buildJppArtifactMap() {

		if (System.getProperty("maven2.ignore.versions") != null || System.getProperty("maven2.jpp.mode") != null) {
			debug("Processing file: /usr/share/java-utils/xml/maven2-versionless-depmap.xml");
			processDepmapFile("/etc/maven/maven2-versionless-depmap.xml");
		}

		debug("Processing file: /usr/share/java-utils/xml/maven2-depmap.xml");
		processDepmapFile("/etc/maven/maven2-depmap.xml");

		String customFileName = System.getProperty("maven2.jpp.depmap.file", null); 
		if (customFileName != null) {
			debug("Processing file: " + customFileName);
			processDepmapFile(customFileName);
		}
	}

	private static void processDepmapFile(String fileName) {
		
		Document mapDocument;

		try {
			mapDocument = (new SAXBuilder()).build(new InputSource(new FileInputStream(fileName)));
		} catch (FileNotFoundException fnfe) {
			System.err.println("ERROR: Unable to find map file: " + fileName);
			fnfe.printStackTrace();
			return;
		} catch (IOException ioe) {
			System.err.println("ERROR: I/O exception occured when opening map file");
			ioe.printStackTrace();
			return;
		} catch (JDOMException jde) {
			System.err.println("ERROR: Unable to instantiate parser");
			jde.printStackTrace();
			return;
		}
		
		List l = mapDocument.getRootElement().getChildren("dependency");
		
		Iterator i = l.iterator();
		while (i.hasNext()) {
			Element depElement = (Element) i.next();

			Element mElem = depElement.getChild("maven");
			Element jppElem = depElement.getChild("jpp");
			
			String mG = mElem.getChildText("groupId");
			String mA = mElem.getChildText("artifactId");
			String mV = mElem.getChildText("version");

			// jppElem == null => drop this dependency
			if (jppElem != null) {

				String jppG = jppElem.getChildText("groupId");
				String jppA = jppElem.getChildText("artifactId");
				String jppV = jppElem.getChildText("version");
                                jppV = jppV != null && jppV.length() > 0 ? jppV : mV;

				if (System.getProperty("maven2.ignore.versions") == null && System.getProperty("maven2.jpp.mode") == null) {
					debug("*** Adding: " + mG+","+mA+","+mV + " => " +  jppG+","+jppA+","+jppV + " to map...");
					jppArtifactMap.put(mG+","+mA+","+mV, jppG+","+jppA+","+jppV);
				} else {
					debug("*** Adding: " + mG+","+mA + " => " +  jppG+","+jppA+","+jppV + " to map...");
					jppArtifactMap.put(mG+","+mA, jppG+","+jppA+","+jppV);
				}
			} else {
					debug("*** Adding: " + mG+","+mA+"," + " => " +  "JPP/maven2,empty-dep,"+mV + " to map...");
					jppArtifactMap.put(mG+","+mA, "JPP/maven2,empty-dep,"+mV);
			}
		}
	}

    private static void debug(String msg) {
        if (System.getProperty("maven2.jpp.debug") != null)
            System.err.println(msg);
    }
}

--- NEW FILE: maven2-2.2.1-update-tests.patch ---
diff -up ./maven-project/src/test/java/org/apache/maven/project/validation/DefaultModelValidatorTest.java.sav ./maven-project/src/test/java/org/apache/maven/project/validation/DefaultModelValidatorTest.java
--- ./maven-project/src/test/java/org/apache/maven/project/validation/DefaultModelValidatorTest.java.sav	2009-11-19 14:47:31.000000000 -0500
+++ ./maven-project/src/test/java/org/apache/maven/project/validation/DefaultModelValidatorTest.java	2009-11-19 14:48:41.000000000 -0500
@@ -73,11 +73,9 @@ public class DefaultModelValidatorTest
     {
         ModelValidationResult result = validate( "invalid-ids-pom.xml" );
 
-        assertEquals( 2, result.getMessageCount() );
-
-        assertEquals( "'groupId' with value 'o/a/m' does not match a valid id pattern.", result.getMessage( 0 ) );
+        assertEquals( 1, result.getMessageCount() );
 
-        assertEquals( "'artifactId' with value 'm$-do$' does not match a valid id pattern.", result.getMessage( 1 ) );
+        assertEquals( "'artifactId' with value 'm$-do$' does not match a valid id pattern.", result.getMessage( 0 ) );
     }
 
     public void testMissingType()




More information about the JPackage-commits mailing list