升级 ActiveMQ Artemis 后的 Hawtio 问题

Issues with Hawtio after upgrading ActiveMQ Artemis

我将 ActiveMQ Artemis 1.5 项目升级到 2.17,但有些东西开始出现问题。有什么推荐的方法可以强制排除自动加载名为 index.html 的文件吗?我不想要 Hawtio 界面,但 pom 似乎自动将它包含在我的 Tomcat 的 webapps 目录中。它正在中断我的常规索引页面的加载。例如,从 pom 中排除 artemis-console 仍然会从 artemis-hawtio 品牌中添加另一个不同的索引文件,也称为 index.html

这一位将创建它。创建了几个 html 个文件和一些其他内容。

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>artemis.playgroud.fake</groupId>
    <artifactId>ArtemisPlayground</artifactId>
    <packaging>war</packaging>
    <name>Fake Webapp</name>
    <description>Fake interproduct communication.</description>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <java.naming.factory.initial>org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory</java.naming.factory.initial>
        <compiler.version>2.5.1</compiler.version>
        <org.springframework.version>5.2.3.RELEASE</org.springframework.version>
        <org.spring-security.version>5.2.3.RELEASE</org.spring-security.version>
    </properties>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
                <version>${org.springframework.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>5.2.3.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-beans</artifactId>
                <version>${org.springframework.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
                <version>${org.springframework.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>${org.springframework.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-expression</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aop</artifactId>
                <version>${org.springframework.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring</artifactId>
                <version>${org.springframework.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>apache-artemis</artifactId>
            <version>2.17.0</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>artemis-jms-client</artifactId>
            <version>2.17.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>artemis-core-client</artifactId>
       <!--     <version>1.5.6</version>  -->
            <version>2.17.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>artemis-junit</artifactId>
            <version>2.17.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>javax.jms</groupId>
            <artifactId>jms</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>5.2.3.RELEASE</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>fake-service</finalName>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>2.2.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-clean-plugin</artifactId>
                    <version>2.4.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${compiler.version}</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>2.5</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>2.3.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>2.3.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-plugin-plugin</artifactId>
                    <version>2.6</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.1</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <index>true</index>
                    <archive>
                        <manifest>
                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                        </manifest>
                        <manifestEntries>
                            <Build-timestamp>${maven.build.timestamp}</Build-timestamp>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

您使用的org.apache.activemq:apache-artemis依赖是pom依赖类型,即:

        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>apache-artemis</artifactId>
            <version>2.17.0</version>
            <type>pom</type>
        </dependency>

出于您的目的(即构建 WAR),这意味着 Maven 将扫描 apache-artemis 中的所有模块并包括任何使用 <packaging>war</packaging> 的模块。在 ActiveMQ Artemis 版本 2.17.0 中,这包括:

  • artemis-console
  • activemq-branding
  • artemis-plugin

你可以看到 Maven 的 war 插件在你的例子 运行 mvn install 上处理这些 pom.xml,例如:

[INFO] --- maven-war-plugin:2.1:war (default-war) @ ArtemisPlayground ---
[INFO] Packaging webapp
[INFO] Assembling webapp [ArtemisPlayground] in [/path/to/fake-service/target/fake-service]
[INFO] Processing war project
[INFO] Processing overlay [ id org.apache.activemq:artemis-console]
[INFO] Processing overlay [ id org.apache.activemq:activemq-branding]
[INFO] Processing overlay [ id org.apache.activemq:artemis-plugin]
[INFO] Webapp assembled in [285 msecs]
[INFO] Building war: /path/to/fake-service/target/fake-service.war

明确地说,这些模块中的 none 存在于您之前使用的 ActiveMQ Artemis 1.5.0 中。您可以从 pom.xml 中排除这些,例如:

        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>apache-artemis</artifactId>
            <version>2.17.0</version>
            <type>pom</type>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.activemq</groupId>
                    <artifactId>artemis-console</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.activemq</groupId>
                    <artifactId>activemq-branding</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.apache.activemq</groupId>
                    <artifactId>artemis-plugin</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

就是说,我不确定您是否真的需要首先配置这个特定的依赖项。如果你真正需要做的就是嵌入代理,你可能只需要使用这个:

      <dependency>
         <groupId>org.apache.activemq</groupId>
         <artifactId>artemis-server</artifactId>
         <version>2.17.0</version>
      </dependency>