Author: riverma
Date: Wed Oct 10 23:24:41 2012
New Revision: 1396859

URL: http://svn.apache.org/viewvc?rev=1396859&view=rev
Log:
OODT-507: maven-cas-install-plugin should remove legacy jars from component's 
lib directory, if customLibs are specified

Modified:
    
oodt/trunk/mvn/plugins/cas-install/src/main/java/org/apache/oodt/cas/install/CASInstallDistMojo.java

Modified: 
oodt/trunk/mvn/plugins/cas-install/src/main/java/org/apache/oodt/cas/install/CASInstallDistMojo.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/mvn/plugins/cas-install/src/main/java/org/apache/oodt/cas/install/CASInstallDistMojo.java?rev=1396859&r1=1396858&r2=1396859&view=diff
==============================================================================
--- 
oodt/trunk/mvn/plugins/cas-install/src/main/java/org/apache/oodt/cas/install/CASInstallDistMojo.java
 (original)
+++ 
oodt/trunk/mvn/plugins/cas-install/src/main/java/org/apache/oodt/cas/install/CASInstallDistMojo.java
 Wed Oct 10 23:24:41 2012
@@ -117,6 +117,40 @@ public class CASInstallDistMojo extends 
                     + casDistributionFile + "] does not exist!");
         }
 
+        // remove cas installation libs directory and its contents if custom 
libs specified.
+        // this is to prevent legacy jars from polluting the cas installation 
libs directory
+        if (customLibs != null && customLibs.length > 0) {
+
+            File libDir = null;
+            
+            // get the lib dir
+            try {
+                libDir = new File(casInstallationDir.getCanonicalPath()
+                        + File.separator + LIB_DIR_NAME);
+
+            } catch (IOException e) {
+                getLog().warn(
+                        "Unable to detect lib dir: IO exception: "
+                                + e.getMessage());
+            }
+
+            // delete the lib dir
+            if (libDir != null) {
+
+                getLog().warn(
+                               "removing pre-existing CAS libraries directory 
["
+                               +libDir.getAbsolutePath()+"] since custom CAS 
libraries have been specified");
+                
+                try {
+                                       FileUtils.deleteDirectory(libDir);
+                               } catch (IOException e) {
+                       getLog().warn(
+                               "Unable to delete lib dir 
["+libDir.getAbsolutePath()+"]: "
+                                       + e.getMessage());
+                               }    
+            }         
+        }
+        
         getLog().info(
                 "unpackaging distro: [" + casDistributionFile + "] to: ["
                         + casInstallationDir + "]");


Reply via email to