Spring boot 2.2 activemq jetty冲突

Spring boot 2.2 activemq jetty conflict

我正在尝试将 Spring boot 与 jetty starter 一起升级到 2.2 版。 由于码头版本冲突,我收到这些错误 以下方法不存在:

'org.eclipse.jetty.websocket.server.NativeWebSocketConfiguration org.eclipse.jetty.websocket.server.NativeWebSocketServletContainerInitializer.initialize(org.eclipse.jetty.servlet.ServletContextHandler)'

方法的 class、org.eclipse.jetty.websocket.server.NativeWebSocketServletContainerInitializer 可从以下位置获得:

jar:file:/some-dir/target/p3.0.166-SNAPSHOT.war!/WEB-INF/lib/jetty-all-9.4.19.v20190610-uber.jar!/org/eclipse/jetty/websocket/server/NativeWebSocketServletContainerInitializer.class
jar:file:/some-dir/target/p3.0.166-SNAPSHOT.war!/WEB-INF/lib/websocket-server-9.4.20.v20190813.jar!/org/eclipse/jetty/websocket/server/NativeWebSocketServletContainerInitializer.class

我有 activemq 依赖项,它引入了它自己的 jetty-all 版本 9.4.19 依赖项,这与 spring-boot 2.2 jetty (9.4.20)

冲突

而我的部分 pom.xml 是:

       <dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
        <exclusions>
            <exclusion>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jetty</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
            <!--
        Jsp-api isn't standard in spring boot
    -->
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>javax.servlet.jsp-api</artifactId>
        <version>${jsp.version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <scope>provided</scope>
    </dependency>

    <!-- artefacts enable JSP running in spring-boot -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
    </dependency>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>apache-jsp</artifactId>
    </dependency>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>apache-jstl</artifactId>
    </dependency>

    <!--
        Used to be a single artifact.
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
        Newer versions splits the interface and implementation.
        This suggests to use a Glassfish implementation.
        https://www.andygibson.net/blog/quickbyte/jstl-missing-from-maven-repositories/
        The one we used had an Apache implementation, so going with that.
        
        -->
    <dependency>
        <groupId>org.apache.taglibs</groupId>
        <artifactId>taglibs-standard-spec</artifactId>
        <version>${taglibs.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.taglibs</groupId>
        <artifactId>taglibs-standard-impl</artifactId>
        <version>${taglibs.version}</version>
    </dependency>
            <!-- Unit test dependencies -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.easytesting</groupId>
        <artifactId>fest-assert</artifactId>
        <version>1.4</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <scope>test</scope>
    </dependency>

    <!-- html compressing is used by hrmanager in the JSP -->
    <dependency>
        <groupId>com.googlecode.htmlcompressor</groupId>
        <artifactId>htmlcompressor</artifactId>
        <version>1.5.2</version>
    </dependency>

    <!-- ApacheMQ HTTP jarfile set -->
    <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-client</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-http</artifactId>
    </dependency>
</dependencies>

知道如何解决这个问题吗?

这里ActiveMQ是错误的

jetty-all 不能用作项目中的依赖项。

https://www.eclipse.org/lists/jetty-users/msg06030.html

它仅作为文档的命令行工具存在,用于向人们介绍 Jetty 的基本功能集。

它没有也不能包含所有 Jetty。

Jetty 生产的一切 的单一工件是不可能的。

正如@Shilan 指出的那样,排除 jetty-all 是正确的解决方案。

使用其他适当的依赖项(似乎是 spring-boot-starter-jetty)将引入您需要的正确的 Jetty 传递依赖项。

你可以在命令行中使用$ mvn dependency:tree来查看这个(排除jetty-all之前和之后)

您可能想要 运行 重复的 class finder maven 插件之一,以查看您正在进行的其他重复 classes 并纠正那些。