Menu

#703 Cannot add filters to lucene-core.jar

v6.0
closed-works-for-me
None
High
2019-12-05
2018-05-09
No

Something strange happens when using Lucene. Version 7.3.0 of Lucene is a multi-release JAR file so I'm trying to filter out META-INF/versions/**. This method works fine for other JARs, however for lucene-core-7.3.0.jar it doesn't. Whenever I add ANY filter (e.g. /home/boris/.gradle/caches/modules-2/files-2.1/org.apache.lucene/lucene-core/7.3.0/40e2de30c5e6bad868b144e371730200719ceb3/lucene-core-7.3.0.jar(!META-INF/versions/9/org/apache/lucene/util/automaton/Automaton.class) or even /home/boris/.gradle/caches/modules-2/files-2.1/org.apache.lucene/lucene-core/7.3.0/40e2de30c5e6bad868b144e371730200719ceb3/lucene-core-7.3.0.jar(), it seems that the whole jar is being skipped as I'm getting a bunch of errors like: Warning: org.apache.lucene.queryparser.classic.QueryParserBase: can't find superclass or interface org.apache.lucene.util.QueryBuilder. The same happens on ProGuard 5.3.3 and 6.0.3. Also, the same issue is with Lucene 7.2.1. Adding ANY filter (even for non-existent files) makes ProGuard not include anything from that JAR. Or so it seems. Am I missing something here?

Discussion

  • Eric Lafortune

    Eric Lafortune - 2018-05-10

    Filtering the contents of a jar seems to work fine for me, also with lucene-core-7.3.0.jar. If you're running ProGuard with command line argument, you'll have to quote the arguments with special characters like (, ), !, to avoid shell expansion. You can check how ProGuard has parsed the configuration with -printconfiguration.

    Otherwise, can you provide a small sample project that illustrates the problem?

     
  • Eric Lafortune

    Eric Lafortune - 2018-05-10
    • status: open --> open-works-for-me
     
  • Boris Petrov

    Boris Petrov - 2018-05-11

    Yes, you are right, this issue can be closed. I was using the filters in Gradle in the wrong way. For anyone reading this in the future, in Gradle somethng like this should be written:

    libraryjars 'path-to-some-file.jar', filter: '!META-INF/versions/**'

    Instead of what I was doing until now:

    libraryjars 'path-to-some-file.jar(!META-INF/versions/**)'

     
  • T. Neidhart

    T. Neidhart - 2019-12-05
    • status: open-works-for-me --> closed-works-for-me
     

Log in to post a comment.