pom.xml.template 是否告诉我使用项目作为依赖项所需知道的一切
我正在尝试添加名为 term 的 lucene 沙箱贡献-highlighter 到我的 pom.xml。 我对 Maven 不太熟悉,但是代码有一个 pom.xml.template 其中 似乎暗示如果我添加一个如下所示的依赖项:
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-highlighter</artifactId>
</dependency>
它可能会起作用。 有人可以帮我将 lucene-community 项目添加到我的 pom.xml 文件中吗?
感谢您的评论,事实证明添加版本就是我所需要的,我只是猜测它应该与我正在使用的 lucene-core 版本相匹配:
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-highlighter</artifactId>
<version>2.3.1</version>
</dependency>
I'm trying to add the lucene sandbox contribution called term-highlighter to my pom.xml.
I'm not really that familiar with Maven, but the code has a pom.xml.template which
seems to imply if I add a dependency that looks like:
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-highlighter</artifactId>
</dependency>
It might work. Can someone help me out in adding a lucene-community project to my pom.xml file?
Thanks for the comments, it turns out that adding the version was all I needed, and I just guessed it should match the lucene-core version I was using.:
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-highlighter</artifactId>
<version>2.3.1</version>
</dependency>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须添加版本号,但只需在项目结构中添加一次。 也就是说,如果版本号是在父 pom 中定义的,则不必再次提供版本号。 (但是在这种情况下您甚至不必提供依赖项,因为无论如何依赖项都会被继承。)
You have to add the version number, but you only have to do it once in a project structure. That is, if the version number is defined in a parent pom, you don't have to give the version number again. (But you don't even have to provide the dependency in this case since the dependency will be inherited anyways.)
你说得对,但你可能也想添加版本:
来自 Maven 5 分钟教程
You have it right, but you probably want to add the version as well:
From The Maven 5 minute tutorial