简体   繁体   English

使用Maven的模块之间(火花和码头)之间的不兼容性

[英]Incompatibilities between modules (spark and jetty) using maven

I'm creating a program that uses spark and jetty libraries. 我正在创建一个使用spark和jetty库的程序。 The dependencies are managed by maven. 依赖项由maven管理。

The problem is that some Classes are not found if bot dependencies are defined. 问题是,如果定义了bot依赖项,则找不到某些类。 Specifically org.eclipse.jetty.server.ServerConnector . 特别是org.eclipse.jetty.server.ServerConnector There are no problems with other classes. 其他课程没有问题。 If I remove the spark-core dependency, all work correctly. 如果我删除了spark-core依赖项,那么一切正常。 Why can this happen? 为什么会这样?

My example is based on this repository and the error can be reproduced adding the spark-core dependency to the "javax.websocket-example" project 我的示例基于此存储库 ,可以重现错误,将spark-core依赖项添加到“javax.websocket-example”项目中

I have tried with different versions of spark-core and jetty- websocket: 我尝试了不同版本的spark-core和jetty- websocket:

  • spark-core (2.10 and 2.11): 1.2.0 and 1.2.1 spark-core(2.10和2.11):1.2.0和1.2.1
  • Javax.websocket-example: 9.3.0.M1, 9.2.7.v20150116 and 9.1.5.v9.1.5.v20140505 Javax.websocket-example:9.3.0.M1,9.2.7.v20150116和9.1.5.v9.1.5.v20140505

Maven dependences: Maven依赖:

    <dependency> <!-- Spark dependency -->
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-core_2.10</artifactId>
        <version>1.2.0</version>
        <!--<scope>provided</scope>-->
    </dependency>
    <dependency> <!-- Jetty dependency -->
        <groupId>org.eclipse.jetty.websocket</groupId>
        <artifactId>javax-websocket-server-impl</artifactId>
        <version>9.2.7.v20150116</version>
        <!--<scope>provided</scope>-->
    </dependency>

EDIT: 编辑:

More information: I have reproduced the error in an empty scenario using vagrant. 详细信息:我在一个空的情况下使用流浪汉重现了该错误。 The box used is this . 使用的盒子就是这个 I have installed maven, git and oracle Java using this manual . 我已经使用本手册安装了maven,git和oracle Java。 I have done the test with "javax.websocket-example" project of this repository . 我已经使用此存储库的 “javax.websocket-example”项目完成了测试。

In this test, the project runs without de spark-core dependency and it doesn't run with the dependence. 在这个测试中,项目在没有de spark-core依赖的情况下运行,并且它不依赖于它。 The version used of the dependency is the last, and I have tried with the project jetty version and with the last of the 9.2.X (9.2.7.v20150116) 使用依赖的版本是最后一个,我尝试使用项目jetty版本和最后的9.2.X(9.2.7.v20150116)

DEPENDECIES: 依赖条件:

    <dependency> 
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-core_2.10</artifactId>
        <version>1.2.1</version>
    </dependency>

This is a dependency problem between the same library with different versions. 这是具有不同版本的同一库之间的依赖性问题。 (spark uses 8.1.XXX and my module uses 9.XX). (spark使用8.1.XXX,我的模块使用9.XX)。 The dependency cannot be excluded because is used in the modules. 不能排除依赖关系,因为在模块中使用了依赖关系。 Then, this problem is a Java dependency problem and there is not solution without other technologies like OSGi 然后,这个问题是一个Java依赖问题,没有其他技术如OSGi就没有解决方案

I Asked similar question here 在这里问了类似的问题

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

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