directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1004643 - in /directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers: AbstractMojoCommand.java MojoHelperUtils.java archive/ArchiveInstallerCommand.java
Date Tue, 05 Oct 2010 13:59:59 GMT
Author: pamarcelot
Date: Tue Oct  5 13:59:59 2010
New Revision: 1004643

URL: http://svn.apache.org/viewvc?rev=1004643&view=rev
Log:
Updated the Archive installer command to exclude the wrapper dependencies (Tanuki Wrapper
and Apache Wraper implementation).

Modified:
    directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/AbstractMojoCommand.java
    directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/MojoHelperUtils.java
    directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/archive/ArchiveInstallerCommand.java

Modified: directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/AbstractMojoCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/AbstractMojoCommand.java?rev=1004643&r1=1004642&r2=1004643&view=diff
==============================================================================
--- directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/AbstractMojoCommand.java
(original)
+++ directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/AbstractMojoCommand.java
Tue Oct  5 13:59:59 2010
@@ -132,33 +132,65 @@ public abstract class AbstractMojoComman
 
     /**
      * Creates both installation and instance layouts.
-     *
-     * @param mojo
-     *      the mojo
+     * 
      * @throws MojoFailureException
      * @throws IOException
      */
     public void createLayouts() throws MojoFailureException, IOException
     {
-        createInstallationLayout();
+        createLayouts( true );
+    }
+
+
+    /**
+     * Creates both installation and instance layouts.
+     *
+     * @param includeWrapperDependencies
+     *      <code>true</code> if wrapper dependencies are included,
+     *      <code>false</code> if wrapper dependencies are excluded
+     *      
+     * @throws MojoFailureException
+     * @throws IOException
+     */
+    public void createLayouts( boolean includeWrapperDependencies ) throws MojoFailureException,
IOException
+    {
+        createInstallationLayout( includeWrapperDependencies );
         createInstanceLayout();
     }
 
 
     /**
      * Creates the installation layout.
+     *      
+     * @throws MojoFailureException
+     * @throws IOException
+     */
+    protected void createInstallationLayout() throws MojoFailureException,
+        IOException
+    {
+        createInstallationLayout( true );
+    }
+
+
+    /**
+     * Creates the installation layout.
      *
+     * @param includeWrapperDependencies
+     *      <code>true</code> if wrapper dependencies are included,
+     *      <code>false</code> if wrapper dependencies are excluded
+     *      
      * @throws MojoFailureException
      * @throws IOException
      */
-    protected void createInstallationLayout() throws MojoFailureException, IOException
+    protected void createInstallationLayout( boolean includeWrapperDependencies ) throws
MojoFailureException,
+        IOException
     {
         // Getting the installation layout and creating directories
         InstallationLayout installationLayout = getInstallationLayout();
         installationLayout.mkdirs();
 
         // Copying dependencies artifacts to the lib folder of the installation layout
-        MojoHelperUtils.copyDependencies( mojo, installationLayout );
+        MojoHelperUtils.copyDependencies( mojo, installationLayout, includeWrapperDependencies
);
 
         // Copying the LICENSE and NOTICE files
         MojoHelperUtils.copyBinaryFile(

Modified: directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/MojoHelperUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/MojoHelperUtils.java?rev=1004643&r1=1004642&r2=1004643&view=diff
==============================================================================
--- directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/MojoHelperUtils.java
(original)
+++ directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/MojoHelperUtils.java
Tue Oct  5 13:59:59 2010
@@ -30,10 +30,10 @@ import java.io.InputStreamReader;
 import java.io.OutputStreamWriter;
 import java.io.Reader;
 import java.io.Writer;
-import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Properties;
+import java.util.Set;
 
 import org.apache.directory.server.InstallationLayout;
 import org.apache.maven.artifact.Artifact;
@@ -117,59 +117,51 @@ public class MojoHelperUtils
     }
 
 
-    public static List copyDependencies( GenerateMojo mymojo, InstallationLayout layout )
+    public static void copyDependencies( GenerateMojo mymojo, InstallationLayout layout )
         throws MojoFailureException
     {
-        List<Artifact> libArtifacts = new ArrayList<Artifact>();
-        Artifact artifact = null;
-        List<String> rejects = new ArrayList<String>();
-
-        //        mymojo.getLog().info( "" );
-        //        mymojo.getLog().info( "    Including artifacts: " );
-        //        mymojo.getLog().info( "    -------------------" );
-        Iterator artifacts = mymojo.getProject().getRuntimeArtifacts().iterator();
+        copyDependencies( mymojo, layout, true );
+    }
+
 
+    public static void copyDependencies( GenerateMojo mymojo, InstallationLayout layout,
+        boolean includeWrapperDependencies )
+        throws MojoFailureException
+    {
+        // Creating the excludes set
+        Set<String> excludes = new HashSet<String>();
+        if ( mymojo.getExcludes() != null )
+        {
+            excludes.addAll( mymojo.getExcludes() );
+        }
+
+        // Adding the wrapper dependencies to the excludes set
+        if ( !includeWrapperDependencies )
+        {
+            excludes.add( "org.apache.directory.server:apacheds-wrapper" );
+            excludes.add( "tanukisoft:wrapper" );
+        }
+
+        // Filtering and copying dependencies
+        Iterator<?> artifacts = mymojo.getProject().getRuntimeArtifacts().iterator();
         while ( artifacts.hasNext() )
         {
-            artifact = ( Artifact ) artifacts.next();
+            Artifact artifact = ( Artifact ) artifacts.next();
             String key = artifact.getGroupId() + ":" + artifact.getArtifactId();
 
-            if ( ( mymojo.getExcludes() != null ) && ( mymojo.getExcludes().contains(
key ) ) )
+            if ( !excludes.contains( key ) )
             {
-                rejects.add( key );
-                continue;
-            }
-
-            try
-            {
-                FileUtils.copyFileToDirectory( artifact.getFile(), layout.getLibDirectory()
);
-                libArtifacts.add( artifact );
-                //                mymojo.getLog().info( "        o " + key );
-            }
-            catch ( IOException e )
-            {
-                throw new MojoFailureException( "Failed to copy dependency artifact " + artifact
+                try
+                {
+                    FileUtils.copyFileToDirectory( artifact.getFile(), layout.getLibDirectory()
);
+                }
+                catch ( IOException e )
+                {
+                    throw new MojoFailureException( "Failed to copy dependency artifact "
+ artifact
                         + " into position " + layout.getLibDirectory() );
+                }
             }
         }
-
-        //        if ( ( mymojo.getExcludes() != null ) && ( !mymojo.getExcludes().isEmpty()
) )
-        //        {
-        //            mymojo.getLog().info( "" );
-        //            mymojo.getLog().info( "    Excluded artifacts: " );
-        //            mymojo.getLog().info( "    ------------------" );
-        //            for ( int ii = 0; ii < rejects.size(); ii++ )
-        //            {
-        //                mymojo.getLog().info( "        o " + rejects.get( ii ) );
-        //            }
-        //        }
-        //        else
-        //        {
-        //            mymojo.getLog().info( "No artifacts have been excluded." );
-        //        }
-        //        mymojo.getLog().info( "" );
-
-        return libArtifacts;
     }
 
 
@@ -177,7 +169,6 @@ public class MojoHelperUtils
     {
         Execute task = new Execute();
         task.setCommandline( cmd );
-        task.setSpawn( true );
         task.setWorkingDirectory( workDir );
 
         if ( doSudo )

Modified: directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/archive/ArchiveInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/archive/ArchiveInstallerCommand.java?rev=1004643&r1=1004642&r2=1004643&view=diff
==============================================================================
--- directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/archive/ArchiveInstallerCommand.java
(original)
+++ directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/archive/ArchiveInstallerCommand.java
Tue Oct  5 13:59:59 2010
@@ -85,7 +85,7 @@ public class ArchiveInstallerCommand ext
         try
         {
             // Creating the installation and instance layouts
-            createLayouts();
+            createLayouts( false );
 
             // Copy bat and sh scripts to bin
             MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(



Mime
View raw message