[ 
https://issues.apache.org/jira/browse/SOLR-1173?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jacob Singh updated SOLR-1173:
------------------------------

    Attachment: xmltask_contrib_build.diff

This patch provides a new task (dist-war-contrib).  This will do a 
contrib-crawl over the contrib/*/build.xml files looking for a dist-war task 
which will get run prior to running dist-war if you run dist.

If you want to modify the web.xml before it is added to the war:

1. Download the xmltask jar from: 
http://sourceforge.net/project/downloading.php?group_id=27398&filename=xmltask-v1.15.1.jar&a=8015257
 and put it in lib

2. Add something like the following to your build.xml (in your contrib 
project): 

<target name="dist-war" depends="dist">
                <xmltask source="${solr-path}/build/web/WEB-INF/web.xml" 
dest="${solr-path}/build/web/WEB-INF/web.xml"
         preserveType="true"
             report="true">
                        <insert path="/web-app/filter[last()]" position="after">
<![CDATA[
  <filter>
    <display-name>HmacFilter</display-name>
    <filter-name>HmacFilter</filter-name>
    <filter-class>com.acquia.search.HmacFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>HmacFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
]]>
            </insert>
        </xmltask>
</target>


3. That's it! Deploy and your changes to web.xml will take effect, no fuss no 
muss.

Note: This does show some warnings for projects that do not implement dist-war


> Let contrib projects modify web.xml when running dist-war
> ---------------------------------------------------------
>
>                 Key: SOLR-1173
>                 URL: https://issues.apache.org/jira/browse/SOLR-1173
>             Project: Solr
>          Issue Type: New Feature
>    Affects Versions: 1.4, 1.5
>            Reporter: Jacob Singh
>             Fix For: 1.4
>
>         Attachments: xmltask_contrib_build.diff
>
>
> Original problem:
> I just wrote a Servlet Filter to handle authentication for our
> service.  Here's what I did:
> 1. Created a dir in contrib
> 2. Put my project in there, I took the dataimporthandler build.xml as
> an example and modified it to suit my needs.  Worked great!
> 3. ant dist now builds my jar and includes it
> I now need to modify web.xml to add my filter-mapping, init params,
> etc.  How can I do this cleanly?  Or do I need to manually open up the
> archive and edit it and then re-war it?
> In common-build I don't see a target for dist-war, so don't see how it
> is possible...
> See: 
> http://mail-archives.apache.org/mod_mbox/lucene-solr-user/200905.mbox/%[email protected]%3e

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to