geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r718644 - in /geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car: ArchiveCarMojo.java ClasspathElement.java
Date Tue, 18 Nov 2008 16:33:38 GMT
Author: gawor
Date: Tue Nov 18 08:33:38 2008
New Revision: 718644

URL: http://svn.apache.org/viewvc?rev=718644&view=rev
Log:
improve manifest classpath generation (GERONIMO-4417)

Modified:
    geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveCarMojo.java
    geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ClasspathElement.java

Modified: geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveCarMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveCarMojo.java?rev=718644&r1=718643&r2=718644&view=diff
==============================================================================
--- geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveCarMojo.java
(original)
+++ geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ArchiveCarMojo.java
Tue Nov 18 08:33:38 2008
@@ -133,6 +133,19 @@
      * @parameter
      */
     private String classpathPrefix = null;
+    
+    /**
+     * Generate classpath prefix based on the artifactId and groupId. The generated classpath
+     * prefix will be in the following form:
+     * <tt>../repository/&lt;groupId&gt;/&lt;artifactId&gt;/&lt;version&gt;</tt>.
+     * This is the default setting applied to all elements of the <tt>classpath</tt>
which
+     * do not provide a prefix or do not set the generateClasspathPrefix parameter.  The

+     * classpath prefix will only be generated if the <tt>classpathPrefix</tt>
parameter is not
+     * set.
+     *
+     * @parameter
+     */
+    private boolean generateClasspathPrefix;
 
     /**
      * Location of resources directory for additional content to include in the car.
@@ -243,7 +256,22 @@
 
                 String prefix = classpath[i].getClasspathPrefix();
                 if (prefix == null) {
-                    prefix = classpathPrefix;
+                    Boolean generatePrefix = classpath[i].getGenerateClasspathPrefix();
+                    if (generatePrefix == null) {
+                        // generatePrefix is not set - try defaults                     
  
+                        if (classpathPrefix == null) {
+                            if (generateClasspathPrefix) {
+                                prefix = generatePrefix(artifact);
+                            }
+                        } else {                            
+                            prefix = classpathPrefix;
+                        }
+                    } else if (Boolean.TRUE.equals(generatePrefix)) {
+                        // generatePrefix is explicitly set to true - generate prefix
+                        prefix = generatePrefix(artifact);
+                    } else {
+                        // generatePrefix is explicitly set to false - leave null prefix
+                    }
                 }
 
                 if (prefix != null) {
@@ -269,4 +297,8 @@
         return buff.toString();
     }
 
-}
\ No newline at end of file
+    private static String generatePrefix(Artifact artifact) {
+        return "../repository/" + artifact.getGroupId().replace('.', '/') + "/" + artifact.getArtifactId()
+ "/" + artifact.getVersion(); 
+    }
+    
+}

Modified: geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ClasspathElement.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ClasspathElement.java?rev=718644&r1=718643&r2=718644&view=diff
==============================================================================
--- geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ClasspathElement.java
(original)
+++ geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/ClasspathElement.java
Tue Nov 18 08:33:38 2008
@@ -78,6 +78,17 @@
      * @parameter
      */
     private String entry;
+    
+    /**
+     * Generate classpath prefix based on the artifactId and groupId. The generated classpath
+     * prefix will be in the following form:
+     * <tt>../repository/&lt;groupId&gt;/&lt;artifactId&gt;/&lt;version&gt;</tt>.
+     * The classpath prefix will only be generated if the <tt>classpathPrefix</tt>
parameter 
+     * is not set.
+     *
+     * @parameter
+     */
+    private Boolean generateClasspathPrefix;
 
     /**
      * @return Returns the artifactId.
@@ -163,6 +174,24 @@
         this.classpathPrefix = classpathPrefix;
     }
 
+    /**     
+     * @return Returns null if the classpath prefix parameter was not set.
+     *         Returns true if the classpath prefix should be automatically generated.
+     *         Returns false if the classpath prefix should NOT be automatically generated.

+     */
+    public Boolean getGenerateClasspathPrefix() {
+        return generateClasspathPrefix;
+    }
+
+    /**
+     * Sets whether classpath prefix should be automatically generated.
+     * 
+     * @param generateClasspathPrefix
+     */
+    public void setGenerateClasspathPrefix(Boolean generateClasspathPrefix) {
+        this.generateClasspathPrefix = generateClasspathPrefix;
+    }
+
     public String getEntry() {
         return entry;
     }



Mime
View raw message