Return-Path: Delivered-To: apmail-directory-users-archive@www.apache.org Received: (qmail 4271 invoked from network); 28 Sep 2010 19:59:49 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 28 Sep 2010 19:59:49 -0000 Received: (qmail 43338 invoked by uid 500); 28 Sep 2010 19:33:09 -0000 Delivered-To: apmail-directory-users-archive@directory.apache.org Received: (qmail 43163 invoked by uid 500); 28 Sep 2010 19:33:08 -0000 Mailing-List: contact users-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@directory.apache.org Delivered-To: mailing list users@directory.apache.org Received: (qmail 43149 invoked by uid 99); 28 Sep 2010 19:33:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Sep 2010 19:33:08 +0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [74.125.82.44] (HELO mail-ww0-f44.google.com) (74.125.82.44) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Sep 2010 19:33:03 +0000 Received: by wwd20 with SMTP id 20so8483wwd.1 for ; Tue, 28 Sep 2010 12:32:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.26.194 with SMTP id c44mr341730wea.104.1285701872670; Tue, 28 Sep 2010 12:24:32 -0700 (PDT) Received: by 10.216.157.208 with HTTP; Tue, 28 Sep 2010 12:24:32 -0700 (PDT) In-Reply-To: <4CA2377D.8040100@apache.org> References: <4CA2377D.8040100@apache.org> Date: Tue, 28 Sep 2010 15:24:32 -0400 Message-ID: Subject: Re: apacheds-maven-plugin and ApacheDS 1.5.7 From: Owen Jacobson To: users@directory.apache.org, felixk@apache.org Content-Type: text/plain; charset=ISO-8859-1 On Tue, Sep 28, 2010 at 2:44 PM, Felix Knecht wrote: > On 09/28/10 19:36, Kiran Ayyagari wrote: >> On Tue, Sep 28, 2010 at 10:49 PM, Owen Jacobson >> wrote: >>> On Tue, Sep 28, 2010 at 1:11 PM, Kiran Ayyagari wrote: >>>> hi Owen, >>>> >>>> On Tue, Sep 28, 2010 at 10:10 PM, Owen Jacobson >>>> wrote: >>>>> Hi there, >>>>> >>>>> As you may have seen in another thread this morning, someone's asked >>>>> that I upgrade apacheds-maven-plugin to ApacheDS 1.5.7. This hasn't >>>>> gone as smoothly as I had hoped. >>>>> >>>>> ApacheDS 1.5.7's mechanism for populating the schema directory >>>>> involves trawling through every entry in the java.class.path system >>>>> property looking for JARs that contain schema files. The relevant code >>>>> is in org.apache.directory.shared:shared-ldap-schema:0.9.19 . Maven >>>>> doesn't use -classpath (or set java.class.path) when running plugins, >>>>> so this mechanism fails - the only JAR it finds is Maven's classworlds >>>>> bootstrap JAR, which obviously has nothing interesting in it. In fact, >>>>> this mechanism fails for any program that doesn't use the root >>>>> classloader to load ApacheDS. >>>>> >>>>> I think the only universally workable solution is to change the >>>>> packaging for the schema LDIF files so that instead of being scanned, >>>>> each JAR that contains schema files also contains an index file at a >>>>> known location (such as META-INF/apacheds/schema) listing all of the >>>>> schema files in that JAR. Unfortunately, that's a pretty >>>>> labour-intensive solution (it means anyone who adds a schema to >>>>> shared-ldap-schema or related artifacts has to remember to update the >>>>> index as well, or that someone has to tune the build to generate the >>>>> index file. I'm happy to set this up, if it turns out to be the best >>>>> solution. (As you can tell, I'm already fairly adept at extending >>>>> Maven. :) >>>> >>>> hmm, though it helps in reduced scan time this again suffers from the >>>> same class loading issue >>> >>> Not at all. shared-ldap-schema-*.jar is available in the classloader >>> ApacheDS is being launched with. By asking that classloader for a >>> resource with a known name (using >>> ClassLoader.getResources(schemaIndexPath)), we skip the scan entirely >>> and go straight to reading the files (also using >>> ClassLoader.getResource... methods). I can patch this up, if you want >>> a demonstration. :) >> hmm, I mean will it solve the issue the maven plugin has in finding >> the schema resources? > > Can't we add any jars in question (containing the ldif files) as a > plugin dependency in the plugins configuration section? So we would have > the sources. We could even pre-extract the ldif files from the dependent > jars into a ... directory and > then use them from this location. I'm not willing to impose the use of dependency:unpack on users of apacheds-maven-plugin, which is what you'd have to use. Adding them to the plugin's dependency list is insufficient (they're already there, in fact - they're a transitive dependency of apacheds-all :), since ResourceMap looks specifically at the java.class.path system property, not at the classloader ApacheDS's classes are actually being loaded from. There's no guarantee that that classloader is enumerable, either, unfortunately. -o