开发者

Adding POM type dependency using m2eclipse, unable to resolve

I am trying to add Hector dependencies to my POM. My IDE is Eclipse, and I am also using m2eclipse. Adding dependencies of JAR type is not a problem, but this dependency is of type POM. I have tried almost everything usual including cleaning, building, and using import scope but n开发者_如何学Cothing seem to have helped. When I try to add import me.prettyprint.hector.api.Serializer; I get the error "The import cannot be resolved".

Is there anything else I need to do to use POM type dependencies or is there a better way of using dependencies of POM types in the project?


I believe his question is not as obvious as simply including the necessary dependency. I have experienced this problem too and am looking for a solution. The problem can be clearer stated as the following:

Let's say I have two maven projects (project A and project B). Project A is a simple web-app which wants to include dependencies as stated in project B. However, project B packaging type is "pom". This should allow all of project B's dependencies to be included into project A. Here is an example:

Project A (packaging is "war"):

<dependencies>
    <dependency>
        <groupId>com.foo</groupId>
        <artifactId>B</artifactId>
        <version>1.0</version>
        <type>pom</type>
    </dependency>
</dependencies>

Project B (packaging is "pom")

<dependencies>
    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
      <version>2.4</version>
    </dependency>
</dependencies>

What we'd like to see in Eclipse is when you run maven eclipse:eclipse on Project A, that you can see the commons-lang-2.4.jar file as a dependency under project A such that you can resolve it in your code when imported. This is not happening and I'm still looking for such a solution.


The error indicates that the relevant class is missing in your classpath. A search of this class indicates, it is available in hector-core

This discussion indicates how this dependency can be imported, viz. adding the following entry to your project pom (or choosing this appropriately in m2eclipse).

<dependency>
    <groupId>me.prettyprint</groupId>
    <artifactId>hector-core</artifactId>
    <version>0.7.0-29</version>
</dependency> 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜