简体   繁体   English

Eclipse-Maven复杂项目依赖关系(ApacheJena)

[英]Eclipse-Maven Complex Project Dependency (ApacheJena)

I'm fairly new to the Eclipse and Maven2 worlds. 我对Eclipse和Maven2世界还很陌生。 I'm struggling to comprehend how to add a Maven project dependency on Apache Jena in a simple way. 我正在努力理解如何以一种简单的方式在Apache Jena上添加Maven项目依赖项。 Specifically, I'd like to add a dependency such as 具体来说,我想添加一个依赖项,例如

<dependency>
  <groupId>org.apache.jena</groupId>
  <artifactId>jena</artifactId>
  <version>${jena.version}</version>
</dependency>

And this would automatically pull in the modules(eg. jena-arq , jena-core , etc). 这会自动拉入模块(例如jena-arqjena-core等)。 However, adding this dependency results in a Missing artifact org.apache.jena:jena:jar:2.11.1 error. 但是,添加此依赖项会导致Missing artifact org.apache.jena:jena:jar:2.11.1错误。 If I add <type>pom</type> to the dependency the error is gone but I do not get the jars in my project. 如果我将<type>pom</type>dependency ,错误消失了,但是我的项目中没有得到jar。

In any event, as I understand it, POM is more suited to project <--modules dependencies and what I'm really looking for is project --> lib archive dependencies. 无论如何,据我所知,POM更适合于项目<-modules依赖性,而我真正要寻找的是project-> lib归档文件的依赖性。

How do I establish such a relationship? 如何建立这种关系? I considered simply replicating the dependency for each module in Jena since it's using a property anyway. 我考虑过简单地复制Jena中每个模块的依赖关系,因为它始终使用属性。 However, it is possible, and Jena is a prime example, that not all modules in a project share the same version. 但是,Jena是一个可能的例子,并非项目中的所有模块都共享同一版本,这是一个很好的例子。 For example jena-core is on 2.11.1 where jena-tdb is on 1.0.1 however jena-2.11.1 encompasses jena-tdb . 例如jena-core在2.11.1上,而jena-tdb在1.0.1上,但是jena-2.11.1包含jena-tdb

Thanks 谢谢

See http://jena.apache.org/download/maven.html for details. 有关详细信息,请参见http://jena.apache.org/download/maven.html

In brief: 简单来说:

  <dependency>
    <groupId>org.apache.jena</groupId>
    <artifactId>apache-jena-libs</artifactId>
    <type>pom</type>
    <version>2.11.1</version> <!-- Set version -->
  </dependency>

Note that it is type pom. 请注意,它是pom类型。

there is not a easy way do this. 没有一个简单的方法可以做到这一点。 you must define every dependency jar with special version. 您必须使用特殊版本定义每个依赖项jar。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM