[ 
https://issues.apache.org/jira/browse/SOLR-3760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13442193#comment-13442193
 ] 

Lance Norskog commented on SOLR-3760:
-------------------------------------

Here is the hard way: repack dependent jars into all contrib dist/ jars. For 
example, pack everything about analysis-extras into dist/*analysis-extras*.jar. 
Remove the contrib lucene libraries from the war file. 

Add this to solr/contrib/analysis-extras/build.xml:
{code:xml}
  <target name="addjars">
    <zip destfile="../../dist/apache-solr-analysis-extras-4.0-SNAPSHOT.jar" 
update="true">
        <zipfileset 
src="../../../lucene/build/analysis/common/lucene-analyzers-common-4.0-SNAPSHOT.jar"
 excludes="META-INF/MANIFEST.MF" />
        <zipfileset 
src="../../../lucene/build/analysis/icu/lucene-analyzers-icu-4.0-SNAPSHOT.jar" 
excludes="META-INF/MANIFEST.MF" />
        <zipfileset 
src="../../../lucene/build/analysis/kuromoji/lucene-analyzers-kuromoji-4.0-SNAPSHOT.jar"
 excludes="META-INF/MANIFEST.MF" />
        <zipfileset 
src="../../../lucene/build/analysis/morfologik/lucene-analyzers-morfologik-4.0-SNAPSHOT.jar"
 excludes="META-INF/MANIFEST.MF" />
        <zipfileset 
src="../../../lucene/build/analysis/phonetic/lucene-analyzers-phonetic-4.0-SNAPSHOT.jar"
 excludes="META-INF/MANIFEST.MF" />
        <zipfileset 
src="../../../lucene/build/analysis/smartcn/lucene-analyzers-smartcn-4.0-SNAPSHOT.jar"
 excludes="META-INF/MANIFEST.MF" />
        <zipfileset 
src="../../../lucene/build/analysis/stempel/lucene-analyzers-stempel-4.0-SNAPSHOT.jar"
 excludes="META-INF/MANIFEST.MF" />

        <zipfileset src="lib/icu4j-49.1.jar" excludes="META-INF/MANIFEST.MF" />
        <zipfileset src="lib/morfologik-fsa-1.5.3.jar" 
excludes="META-INF/MANIFEST.MF" />
        <zipfileset src="lib/morfologik-polish-1.5.3.jar" 
excludes="META-INF/MANIFEST.MF" />
        <zipfileset src="lib/morfologik-stemming-1.5.3.jar" 
excludes="META-INF/MANIFEST.MF" />
    </zip>
  </target>
{code}

Run 'ant dist addjars'. The dist jar goes from 20k (one file) to 21M (4035 
files). But, it is 21M in one deployable file. Everything is in one place! (If 
the size bothers you, split the Chinese, Japanese and Polish support into 
separate contribs.)

Caveats:
* This approach needs a little rearranging of the order of the build steps. 
There is no place visible to the contrib build.xml where the solr/build dist 
jar is finished, but not yet copied to dist/. I don't know what to do about 
META-INF files in the absorbed libraries. This approach just preserves the 
manifest file. 

* Redundant dependencies: 
** analysis-extras and extraction both use icu4j, which is a huge jar. Too bad.
** dataimporter wants all of extraction. Stick with the current arrangement.

This design is appropriate for analysis-extras, uima and opennlp. All of these 
have lucene libraries and lib/ directories, and the current build arrangement 
just plain does not work. It is a convenience for clustering, dataimporthandler 
(-extras), extraction, langid, and velocity. 

The build.xml file above needs macro-izing. As mentioned the build sequence 
needs a point where the contrib build can repack the dist file inside 
solr/build.
                
> Build packaging of complex contrib packages just plain does not work
> --------------------------------------------------------------------
>
>                 Key: SOLR-3760
>                 URL: https://issues.apache.org/jira/browse/SOLR-3760
>             Project: Solr
>          Issue Type: Improvement
>          Components: Build
>            Reporter: Lance Norskog
>
> The build system packages Lucene libraries in the Solr war, but they do not 
> pack libraries required by the Lucene libraries. The UIMA and analysis-extras 
> contrib packages have factories for the Lucene libraries.
> The net effect is that when solrconfig.xml include <lib> directives for 
> dist/xxx-contribX-xxx.jar and solr/contrib/contribX/lib, this fails because 
> the lucene analyzer file inside the solr war cannot find the library files in 
> solr/contrib/contribX/lib because the classloader for the war does not find 
> the libraries from the <lib> directives.
> Two alternative fixes are presented below.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to