2011-10-12 36 views
-1

我正在使用Lucene 3.4.0,hibernate(hibernate-all.jar),ANT和TestNG來運行一些測試... 大部分工作現在,但由於我已經實現了我的lucene當我使用ant命令時,一切似乎都不起作用......我有些迷失在這裏。Lucene:找不到符號

因爲一切都在當地完美工作。我可以運行我的測試,編譯等等。就像我試圖用ant構建的那樣,我得到構造者StandartAnalyzer(版本)等的這個錯誤「找不到符號」等等......

但是就像我說的,一切工作在日食...起初,我有一個方法沒有找到錯誤,但修復它,因爲休眠與最新版本的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. 

回答

0

好吧修好了。我需要在我的lib/test中添加jar文件(我正在使用seam框架)。在eclipse中,一切正常,因爲我在TestNG的運行配置中指向了jar。當我運行命令「螞蟻測試」時,沒有發現罐子...

所以,感謝大家。

另外,對於那些想要使用lucene和seam的人來說,確保沒有版本不兼容。我有這個問題很長一段時間。最後,我發現我必須使用舊版本的lucene(2.4.1)來處理seam 2.2。我沒有檢查lucene 3.4和seam 3 ...

1

這可能是Eclipse和Ant分別使用的類的不同之處。檢查Eclipse內部正在使用哪些jar包(將哪些庫添加到項目中),然後在您使用它構建時在聲明的Ant類路徑中使用哪些jar。另請檢查您是否在Eclipse和Ant中使用相同的JDK。如果兩者中的任何一個不同,請將Ant的更改爲Eclipse(因爲這是可以工作的環境)

1

檢查Ant類路徑以獲取多個版本的Lucene庫。做ant -diagnostics檢查螞蟻環境。