activemq-all 强制我使用 log4j slf4j 实现

Eri*_* VV 5 activemq-classic log4j logback slf4j maven

我想在我的应用程序中使用 logback slf4j 实现,但是 activemq-all 通过包含 log4j 实现类破坏了类路径。我不是唯一面临这个问题的人,例如多个 SLF4J 绑定错误与 activemq-all-5.6.0.jar 所见证的那样。根据那篇文章,我必须将 activemq-all 替换为

org.apache.activemq:activemq-camel
org.apache.activemq:activemq-core
org.apache.activemq:activemq-console
org.apache.activemq:activemq-jaas
org.apache.activemq:activemq-optional
org.apache.activemq:kahadb
org.apache.geronimo.specs:geronimo-jms_1.1_spec
org.apache.geronimo.specs:geronimo-jta_1.0.1B_spec
org.apache.geronimo.specs:geronimo-j2ee-management_1.1_spec
org.apache.geronimo.specs:geronimo-annotation_1.0_spec.
Run Code Online (Sandbox Code Playgroud)

问题是我没有这些工件的完整 maven 依赖项(组 ID、工件 ID、版本)。有人可以为我提供现成的替代品吗

        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-all</artifactId>
            <version>5.9.0</version>
        </dependency> 
Run Code Online (Sandbox Code Playgroud)

Pet*_*der 1

简而言之,您已经列出了您找到的工件的组 ID/工件 ID ,并用冒号分隔。请注意,这些满足 ActiveMQ 5.6 的某些用例。例如,activemq-core 不再真正有效 - 使用 activemq-client 和 activemq-broker 代替。

目前,这些工件捆绑在 activemq-all 中。但您可能需要查看您选择的版本的pom.xml (此列表可能会随着时间的推移而改变)。您可能不需要所有这些,除非您打算在应用程序中嵌入具有所有传输、插件和配置的代理。

<artifactSet>
  <includes>
    <include>${project.groupId}:activemq-client</include>
    <include>${project.groupId}:activemq-openwire-legacy</include>
    <include>${project.groupId}:activemq-camel</include>
    <include>${project.groupId}:activemq-jaas</include>
    <include>${project.groupId}:activemq-broker</include>
    <include>${project.groupId}:activemq-console</include>
    <include>${project.groupId}:activemq-shiro</include>
    <include>${project.groupId}:activemq-spring</include>
    <include>${project.groupId}:activemq-pool</include>
    <include>${project.groupId}:activemq-jms-pool</include>
    <include>${project.groupId}:activemq-amqp</include>
    <include>${project.groupId}:activemq-http</include>
    <include>${project.groupId}:activemq-mqtt</include>
    <include>${project.groupId}:activemq-stomp</include>
    <include>${project.groupId}:activemq-kahadb-store</include>
    <include>${project.groupId}:activemq-leveldb-store</include>
    <include>${project.groupId}:activemq-jdbc-store</include>
    <include>org.apache.activemq.protobuf:activemq-protobuf</include>
    <include>org.fusesource.hawtbuf:hawtbuf</include>
    <include>org.jasypt:jasypt</include>
    <include>org.apache.geronimo.specs:geronimo-jms_1.1_spec</include>
    <include>org.apache.geronimo.specs:geronimo-jta_1.0.1B_spec</include>
    <include>org.apache.geronimo.specs:geronimo-j2ee-management_1.1_spec</include>
    <include>org.apache.geronimo.specs:geronimo-annotation_1.0_spec</include>
    <include>org.slf4j:slf4j-api</include>
    <include>org.slf4j:slf4j-log4j12</include>
    <include>log4j:log4j</include>
  </includes>
</artifactSet>
Run Code Online (Sandbox Code Playgroud)

好的,org.apache.activemq 的版本号应该只是您要使用的版本。对于 geronimo 规范,这并不是那么明显。

<dependency>
   <groupId>org.apache.geronimo.specs</groupId>
   <artifactId>geronimo-jms_1.1_spec</artifactId>
   <version>1.1.1</version>
</dependency>

<dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-j2ee-management_1.1_spec</artifactId>
      <version>1.0.1</version>
</dependency>

<dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-annotation_1.0_spec</artifactId>
      <version>1.1.1</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)