wildfly-maven-plugin不会部署任何东西

时间:2016-06-11 10:21:58

标签: maven-3 maven-plugin wildfly-8

我希望Maven启动一个wildfly服务器,该服务器位于/path/to/project/target/wildfly-8.1.2-Final的目标文件夹中。该插件应该在预集成测试阶段部署war-artifact。在wildfly-maven-plugin开始之前,这个神器是在封装阶段由maven-war-plugin创建的。

运行maven构建时,wildfly会启动,但不会部署任何内容。它只是在启动后挂起,让Maven构建在超时60秒后失败...

这是我有效的pom:

<plugin>
    <groupId>org.wildfly.plugins</groupId>
    <artifactId>wildfly-maven-plugin</artifactId>
    <version>1.1.0.Alpha8</version>
    <executions>
      <execution>
        <phase>pre-integration-test</phase>
        <goals>
          <goal>start</goal>
          <goal>deploy</goal>
        </goals>
        <configuration>
          <port>18080</port>
          <timeout>60</timeout>
          <skip>false</skip>
          <hostname>127.0.0.1</hostname>
          <name>/path/to/project/target/my-artifact.war</name>
          <targetDir>/path/to/project/target/wildfly-8.2.1.Final/standalone/deployments</targetDir>
          <server-config>standalone.xml</server-config>
          <username>wildfly-test</username>
          <password>wildfly.1234</password>
          <add-user>
            <users>
              <user>
                <username>wildfly-admin</username>
                <password>wildfly.1234</password>
                <groups>
                  <group>admin</group>
                  <group>user</group>
                </groups>
                <application-user>false</application-user>
                <realm>ManagementRealm</realm>
              </user>
              <user>
                <username>wildfly-test</username>
                <password>wildfly.1234</password>
                <groups>
                  <group>user</group>
                </groups>
                <application-user>true</application-user>
                <realm>ApplicationRealm</realm>
              </user>
            </users>
          </add-user>
        </configuration>
      </execution>
      <execution>
        <phase>post-integration-test</phase>
        <goals>
          <goal>undeploy</goal>
          <goal>shutdown</goal>
        </goals>
        <configuration>
          <hostname>127.0.0.1</hostname>
          <port>18888</port>
          <skip>false</skip>
          <name>/path/to/project/target/my-artifact.war</name>
          <targetDir>/path/to/project/target/wildfly-8.2.1.Final/standalone/deployments</targetDir>
          <server-config>standalone.xml</server-config>
          <username>wildfly-test</username>
          <password>wildfly.1234</password>
          <add-user>
            <users>
              <user>
                <username>wildfly-admin</username>
                <password>wildfly.1234</password>
                <groups>
                  <group>admin</group>
                  <group>user</group>
                </groups>
                <application-user>false</application-user>
                <realm>ManagementRealm</realm>
              </user>
              <user>
                <username>wildfly-test</username>
                <password>wildfly.1234</password>
                <groups>
                  <group>user</group>
                </groups>
                <application-user>true</application-user>
                <realm>ApplicationRealm</realm>
              </user>
            </users>
          </add-user>
        </configuration>
      </execution>
    </executions>
    <configuration>
      <skip>false</skip>
      <hostname>127.0.0.1</hostname>
      <port>18080</port>
      <name>/path/to/project/target/my-artifact.war</name>
      <targetDir>/path/to/project/target/wildfly-8.2.1.Final/standalone/deployments</targetDir>
      <server-config>standalone.xml</server-config>
      <username>wildfly-test</username>
      <password>wildfly.1234</password>
      <add-user>
        <users>
          <user>
            <username>wildfly-admin</username>
            <password>wildfly.1234</password>
            <groups>
              <group>admin</group>
              <group>user</group>
            </groups>
            <application-user>false</application-user>
            <realm>ManagementRealm</realm>
          </user>
          <user>
            <username>wildfly-test</username>
            <password>wildfly.1234</password>
            <groups>
              <group>user</group>
            </groups>
            <application-user>true</application-user>
            <realm>ApplicationRealm</realm>
          </user>
        </users>
      </add-user>
    </configuration>
  </plugin>

有没有人经历过类似的行为?

也许有人可以给我一个关于这里有什么问题的指针...非常感谢任何帮助。

由于 沃尔特

2 个答案:

答案 0 :(得分:0)

您正在使用端口18080.我猜您正在使用18888,您是否更改了端口?
默认配置为8080。

答案 1 :(得分:0)

阅读文档后,我可以告诉它不清楚<port/>的用途。 port配置属性用于告诉插件管理接口正在侦听哪个端口。这就是使用端口9990的原因。与<hostname/>相同。

<targetDir/>似乎也是错误的。它命名不佳,但该目录用于查找部署。基本上它是maven放置编译档案的目标目录。

查看配置,您需要定义许多不必要的默认值。以下是您发布的示例中插件配置的示例精简版本。

<plugin>
  <groupId>org.wildfly.plugins</groupId>
  <artifactId>wildfly-maven-plugin</artifactId>
  <version>1.1.0.Alpha8</version>
  <executions>
    <execution>
      <phase>pre-integration-test</phase>
      <goals>
        <goal>start</goal>
        <goal>deploy</goal>
      </goals>
      <configuration>
        <add-user>
          <users>
            <user>
              <username>wildfly-admin</username>
              <password>wildfly.1234</password>
              <groups>
                <group>admin</group>
                <group>user</group>
              </groups>
              <application-user>false</application-user>
              <realm>ManagementRealm</realm>
            </user>
            <user>
              <username>wildfly-test</username>
              <password>wildfly.1234</password>
              <groups>
                <group>user</group>
              </groups>
              <application-user>true</application-user>
              <realm>ApplicationRealm</realm>
            </user>
          </users>
        </add-user>
      </configuration>
    </execution>
    <execution>
      <phase>post-integration-test</phase>
      <goals>
        <goal>undeploy</goal>
        <goal>shutdown</goal>
      </goals>
    </execution>
  </executions>
</plugin>