Lucene:找不到符号

发布于 2024-12-09 06:10:08 字数 2622 浏览 1 评论 0原文

我正在使用 Lucene 3.4.0、hibernate (hibernate-all.jar)、ANT 和 TestNG 来运行一些测试... 现在大多数工作都有效,但是由于我已经实现了 lucene 部分,当我使用 ant 命令时似乎没有任何工作......我有点迷失在这里。

因为一切都在本地完美运行。我可以运行我的测试、编译等。一旦我尝试使用 ant 构建,我就会收到此错误“找不到构造函数 StandartAnalyzer(version.) 的符号”等...

但就像我说的,一切正常eclipse...起初,我有一个方法未找到错误,但修复了它,因为hibernate与最新版本的lucene不兼容。所以我升级了休眠......但现在,我明白了。

谢谢。如果您需要更多信息,请询问。

    $ ant explode
Buildfile: c:\DuplicateBugFinder\dbf\build.xml

init:

groovy.compile:

groovy.copy:

compile:
    [javac] c:\DuplicateBugFinder\dbf\build.xml:156: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=l
st; set to false for repeatable builds
    [javac] Compiling 27 source files to c:\DuplicateBugFinder\dbf\exploded-archives\dbf.ear\dbf_jar
    [javac] c:\DuplicateBugFinder\dbf\src\hot\com\rim\sts\dbf\business\service\classification\LuceneClassificationAlgorithm.java:
6: cannot find symbol
    [javac] symbol  : constructor StandardAnalyzer(org.apache.lucene.util.Version)
    [javac] location: class org.apache.lucene.analysis.standard.StandardAnalyzer
    [javac]     Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_34);
    [javac]                         ^
    [javac] c:\DuplicateBugFinder\dbf\src\hot\com\rim\sts\dbf\business\service\classification\LuceneClassificationAlgorithm.java:
2: cannot find symbol
    [javac] symbol  : constructor QueryParser(org.apache.lucene.util.Version,java.lang.String,org.apache.lucene.analysis.Analyzer

    [javac] location: class org.apache.lucene.queryParser.QueryParser
    [javac]             new QueryParser(Version.LUCENE_34, "title", analyzer)
    [javac]             ^
    [javac] c:\DuplicateBugFinder\dbf\src\hot\com\rim\sts\dbf\business\service\classification\LuceneClassificationAlgorithm.java:
9: cannot find symbol
    [javac] symbol  : constructor IndexSearcher(org.apache.lucene.store.Directory,boolean)
    [javac] location: class org.apache.lucene.search.IndexSearcher
    [javac]       searcher = new IndexSearcher(index, true);
    [javac]                  ^
    [javac] c:\DuplicateBugFinder\dbf\src\hot\com\rim\sts\dbf\business\service\classification\LuceneClassificationAlgorithm.java:
00: cannot find symbol
    [javac] symbol  : method search(org.apache.lucene.search.Query,org.apache.lucene.search.TopScoreDocCollector)
    [javac] location: class org.apache.lucene.search.IndexSearcher
    [javac]       searcher.search(q, collector);
    [javac]               ^
    [javac] 4 errors

BUILD FAILED
c:\DuplicateBugFinder\dbf\build.xml:156: Compile failed; see the compiler error output for details.

I am using Lucene 3.4.0, hibernate (hibernate-all.jar), ANT and TestNG to run some test...
Most of all works right now, but since I have implemented my lucene part nothing seems to work when I use ant command... I'm kind of lost here.

Because everything works perfectly locally. I can run my test, compile, etc. As soons as, I try to build with ant, I get this error "cannot find symbol" for contructor StandartAnalyzer(version.), etc...

But like I said, everything works on eclipse... At first, I had an method not found error, but fixed it because hibernate is not compatible with the latest version of lucene. So I upgraded hibernate... but now, I get this.

Thank you. If you need more information plz ask.

    $ ant explode
Buildfile: c:\DuplicateBugFinder\dbf\build.xml

init:

groovy.compile:

groovy.copy:

compile:
    [javac] c:\DuplicateBugFinder\dbf\build.xml:156: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=l
st; set to false for repeatable builds
    [javac] Compiling 27 source files to c:\DuplicateBugFinder\dbf\exploded-archives\dbf.ear\dbf_jar
    [javac] c:\DuplicateBugFinder\dbf\src\hot\com\rim\sts\dbf\business\service\classification\LuceneClassificationAlgorithm.java:
6: cannot find symbol
    [javac] symbol  : constructor StandardAnalyzer(org.apache.lucene.util.Version)
    [javac] location: class org.apache.lucene.analysis.standard.StandardAnalyzer
    [javac]     Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_34);
    [javac]                         ^
    [javac] c:\DuplicateBugFinder\dbf\src\hot\com\rim\sts\dbf\business\service\classification\LuceneClassificationAlgorithm.java:
2: cannot find symbol
    [javac] symbol  : constructor QueryParser(org.apache.lucene.util.Version,java.lang.String,org.apache.lucene.analysis.Analyzer

    [javac] location: class org.apache.lucene.queryParser.QueryParser
    [javac]             new QueryParser(Version.LUCENE_34, "title", analyzer)
    [javac]             ^
    [javac] c:\DuplicateBugFinder\dbf\src\hot\com\rim\sts\dbf\business\service\classification\LuceneClassificationAlgorithm.java:
9: cannot find symbol
    [javac] symbol  : constructor IndexSearcher(org.apache.lucene.store.Directory,boolean)
    [javac] location: class org.apache.lucene.search.IndexSearcher
    [javac]       searcher = new IndexSearcher(index, true);
    [javac]                  ^
    [javac] c:\DuplicateBugFinder\dbf\src\hot\com\rim\sts\dbf\business\service\classification\LuceneClassificationAlgorithm.java:
00: cannot find symbol
    [javac] symbol  : method search(org.apache.lucene.search.Query,org.apache.lucene.search.TopScoreDocCollector)
    [javac] location: class org.apache.lucene.search.IndexSearcher
    [javac]       searcher.search(q, collector);
    [javac]               ^
    [javac] 4 errors

BUILD FAILED
c:\DuplicateBugFinder\dbf\build.xml:156: Compile failed; see the compiler error output for details.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

你对谁都笑 2024-12-16 06:10:09

检查 ant 类路径中是否有多个版本的 Lucene 库。执行 ant -diagnostics 检查 ant 环境。

Check the ant classpath for multiple versions of Lucene library. Do ant -diagnostics to check the ant environment.

滥情哥ㄟ 2024-12-16 06:10:09

好的,修好了。我需要将 jar 文件添加到我的 lib/test 中(我使用的是 seam 框架)。在 Eclipse 中,一切正常,因为我指向 TestNG 的运行配置中的 jar。当我运行命令“ant test”时,没有找到 jar...

所以谢谢大家。

另外,对于那些想要使用 lucene 和 seam 的人来说,请确保没有版本不兼容的问题。我有这个问题很长时间了。最后,我发现我必须使用旧版本的 lucene (2.4.1) 才能使用 seam 2.2。我还没有检查 lucene 3.4 和 seam 3...

Ok fixed it. I needed to add the jar file in my lib/test (I'm using seam framework). In eclipse, everything was working because I was pointing to the jar in my run configurations for TestNG. When I was running the command "ant test" no jar was found...

So thanks to everyone.

Plus, for those of you who wants to make use of lucene and seam make sure too have no version incompatibilty. I had this problem for a long time. Finally, I found out that I had to use an older version of lucene (2.4.1) to work with seam 2.2. I didn't check yet for lucene 3.4 and seam 3...

°如果伤别离去 2024-12-16 06:10:08

这可能是 Eclipse 和 Ant 分别使用的类路径不同。检查您在 Eclipse 中到底使用了哪些 jar(将哪些库添加到项目中),然后在构建时在声明的 Ant 类路径中使用了哪些 jar。另请检查您在 Eclipse 和 Ant 中是否使用相同的 JDK。如果两者中的任何一个不同,请将 Ant 更改为类似 Eclipse(因为这是可以工作的环境)

It's probablly a difference in the classpathes used by Eclipse and by Ant respectively. Check what jars are you exactly using inside Eclipse (what libraries are added to the project) and then what jars you use in your declared Ant classpath when you build with that. Also check that you're using the same JDK in Eclipse and Ant. If either of the two differ, change Ant ones to be like Eclipse (since that's the environment that does work)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文