2008-10-03 28 views
0

我想添加一個名爲term-highlighter我的pom.xml Lucene的沙箱的貢獻。 我真的不那麼熟悉Maven的,但代碼有一個pom.xml.template這 似乎在暗示,如果我添加一個依賴,看起來像:做了pom.xml.template告訴我一切,我需要知道使用該項目作爲一個依賴

<dependency> 
    <groupId>org.apache.lucene</groupId> 
    <artifactId>lucene-highlighter</artifactId> 
</dependency> 

它可能會奏效。有人可以幫我添加一個lucene-community項目到我的pom.xml文件嗎?

感謝您的意見,事實證明,加入的版本是我所需要的,我只是猜測它應該符合我所用:

<dependency> 
    <groupId>org.apache.lucene</groupId> 
    <artifactId>lucene-highlighter</artifactId> 
    <version>2.3.1</version> 
</dependency> 

回答

3

您必須添加的版本號,但你只有在一個凸出一旦做到這一點等結構。也就是說,如果版本號是在父pom中定義的,則不必再次提供版本號。 (但是在這種情況下你甚至不需要提供依賴關係,因爲依賴關係會被繼承。)

1

你是不是正確的Lucene的核心版本,但你可能要添加的版本還有:

From The Maven 5 minute tutorial

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.mycompany.app</groupId> 
    <artifactId>my-app</artifactId> 
    <packaging>jar</packaging> 
    <version>1.0-SNAPSHOT</version> 
    <name>Maven Quick Start Archetype</name> 
    <url>http://maven.apache.org</url> 

    <dependencies> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>3.8.1</version> 
     <scope>test</scope> 
    </dependency> 
    </dependencies> 

</project> 
相關問題