Reputation: 139
When implementing tokenization by using Lucene a problem related to org.apache.lucene.analysis.StandardAnalyzer
occurred as the following exception was thrown:
The import org.apache.lucene.analysis.StandardAnalyzer cannot be resolved
I added dependencies to Maven pom.xml (see below) but the same exception was thrown again.
I used those dependencies:
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>5.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-common</artifactId>
<version>5.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-queryparser</artifactId>
<version>5.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-queries</artifactId>
<version>5.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-test-framework</artifactId>
<version>5.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers</artifactId>
<version>3.6.2</version>
</dependency>
Upvotes: 2
Views: 4733
Reputation: 33341
Remove the lucene-analyzers
dependency.
You can't mix-and-match package versions with lucene, and the lucene-analyzers
package is no longer used. You already have the dependency to lucene-analyzers-common
, which is what you should be using.
Also, you need to import org.apache.lucene.analysis.standard.StandardAnalyzer
, instead of org.apache.lucene.analysis.StandardAnalyzer
.
Upvotes: 3