You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2008/11/18 17:33:38 UTC

svn commit: r718644 - in /geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car: ArchiveCarMojo.java ClasspathElement.java

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;
     }



Re: svn commit: r718644 - in /geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car: ArchiveCarMojo.java ClasspathElement.java

Posted by Jarek Gawor <jg...@gmail.com>.
On Tue, Nov 18, 2008 at 1:51 PM, David Jencks <da...@yahoo.com> wrote:
>
> The previous way we did this was to keep the minimal possible stuff in lib
> and fire up a geronimo kernel with a repository gbean in it to abstract the
> actual structure of the repo for command line clients.  My (quite possibly
> wrong) understanding is that gshell is doing something similar using some
> ivy classes.
>
> Can you write these plugins to depend on the client-system plugin and run
> them as app clients?

Well, I can fix my particular problem by either dumping
geronimo-system.jar into the "lib" dir or by moving some classes (e.g.
RepositoryConfigurationStore.java) from geronimo-system to
geronimo-kernel. Let me if either of these sounds good to you.
I don't really want to start up a whole app container just to execute
some command line tool. I did look into booting a basic kernel with a
repo gbean (sort of what deployer or client does) but that will
require a separate plugin. And I already have two plugins just to
deploy and install the jaxws tooling. I guess I should re-consider
this option.

> I have to say I'm not very happy about the current state of geronimo
> startup.  IIUC gshell is using spring, ivy, and ant to set up the jvm for
> geronimo which is then using the geronimo kernel to set up a whole other set
> of classloaders using imitation maven classes.  I surely don't have a
> solution but this seems just too complex with too much duplicated
> functionality to me.

Btw, the version of GShell used in Geronimo trunk just loads the jar
files from the lib or the repository directory as specified in the
etc/gsh-classworlds.conf file.

Jarek

Re: svn commit: r718644 - in /geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car: ArchiveCarMojo.java ClasspathElement.java

Posted by David Jencks <da...@yahoo.com>.
On Nov 18, 2008, at 10:09 AM, Jarek Gawor wrote:

> David,
>
> Yes, the generated classpath manifest for the these plugins would
> assume a certain directory structure. But a certain directory
> structure was already assumed before my changes. Before the plugins
> assumed that all the depended files lived under the "../lib"
> directory. How is that different?
> My changes were intended to be used by the plugins that serve as
> command line clients (executed via java -jar) and not any other
> plugins. I wanted to avoid copying more files into the "lib" directory
> and instead using the jar files directly from the "repository"
> directory. I think we had a similar issue with GShell before.

The previous way we did this was to keep the minimal possible stuff in  
lib and fire up a geronimo kernel with a repository gbean in it to  
abstract the actual structure of the repo for command line clients.   
My (quite possibly wrong) understanding is that gshell is doing  
something similar using some ivy classes.

Can you write these plugins to depend on the client-system plugin and  
run them as app clients?

I have to say I'm not very happy about the current state of geronimo  
startup.  IIUC gshell is using spring, ivy, and ant to set up the jvm  
for geronimo which is then using the geronimo kernel to set up a whole  
other set of classloaders using imitation maven classes.  I surely  
don't have a solution but this seems just too complex with too much  
duplicated functionality to me.

thanks
david jencks

>
>
> Jarek
>
> On Tue, Nov 18, 2008 at 12:12 PM, David Jencks  
> <da...@yahoo.com> wrote:
>> -1, at least without some discussion.
>>
>> One of the principles of geronimo is that we try to make components
>> independent where possible.  For instance, we don't let the  
>> particular
>> implementation of Repository leak into other parts of the server.   
>> This
>> change firmly fixes our current repository structure into any  
>> plugin that
>> uses this new functionality and makes it impossible to run such  
>> plugins on
>> any other repository implementation.
>>
>> thanks
>> david jencks
>>
>> On Nov 18, 2008, at 8:33 AM, gawor@apache.org wrote:
>>
>>> 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;
>>>   }
>>>
>>>
>>
>>


Re: svn commit: r718644 - in /geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car: ArchiveCarMojo.java ClasspathElement.java

Posted by Jarek Gawor <jg...@gmail.com>.
David,

Yes, the generated classpath manifest for the these plugins would
assume a certain directory structure. But a certain directory
structure was already assumed before my changes. Before the plugins
assumed that all the depended files lived under the "../lib"
directory. How is that different?
My changes were intended to be used by the plugins that serve as
command line clients (executed via java -jar) and not any other
plugins. I wanted to avoid copying more files into the "lib" directory
and instead using the jar files directly from the "repository"
directory. I think we had a similar issue with GShell before.

Jarek

On Tue, Nov 18, 2008 at 12:12 PM, David Jencks <da...@yahoo.com> wrote:
> -1, at least without some discussion.
>
> One of the principles of geronimo is that we try to make components
> independent where possible.  For instance, we don't let the particular
> implementation of Repository leak into other parts of the server.  This
> change firmly fixes our current repository structure into any plugin that
> uses this new functionality and makes it impossible to run such plugins on
> any other repository implementation.
>
> thanks
> david jencks
>
> On Nov 18, 2008, at 8:33 AM, gawor@apache.org wrote:
>
>> 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;
>>    }
>>
>>
>
>

Re: svn commit: r718644 - in /geronimo/server/trunk/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car: ArchiveCarMojo.java ClasspathElement.java

Posted by David Jencks <da...@yahoo.com>.
-1, at least without some discussion.

One of the principles of geronimo is that we try to make components  
independent where possible.  For instance, we don't let the particular  
implementation of Repository leak into other parts of the server.   
This change firmly fixes our current repository structure into any  
plugin that uses this new functionality and makes it impossible to run  
such plugins on any other repository implementation.

thanks
david jencks

On Nov 18, 2008, at 8:33 AM, gawor@apache.org wrote:

> 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;
>     }
>
>