wildfly-maven-plugin doesn't deploy anything

依然范特西╮ 提交于 2019-12-07 20:28:41

问题


I would like Maven to start up a wildfly server which is available in my target-folder at /path/to/project/target/wildfly-8.1.2-Final. The plugin is supposed to deploy a war-artifact during pre-integration-test phase. That very artifact was created by maven-war-plugin during package-phase right before wildfly-maven-plugin starts.

When running the maven build, wildfly starts up, however does not deploy anything. It just hangs after starting up and lets the Maven build fail after a timeout of 60 seconds...

This is my effective 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>

Has anybody experienced a similar behaviour?

Maybe somebody could give me a pointer on what is wrong here... Any help is highly appreciated.

Thanks Walter


回答1:


You are using port 18080. I guess, as you are using 18888 either you changed the port?
The default configuration is 8080.




回答2:


After reading the documentation I can tell it's not clear what <port/> is used for. The port configuration property is used to tell the plugin which port the management interface is listening on. That is why using port 9990 works. Same with the <hostname/>.

The <targetDir/> seems to be wrong as well. It's poorly named, but that directory is used find the deployment. Essentially it's the target directory where maven put the compiled archive.

Looking at the configuration you're defining a lot of the defaults that shouldn't be necessary. Below is an example stripped down version of the plugin configuration from the example you posted.

<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>


来源:https://stackoverflow.com/questions/37762598/wildfly-maven-plugin-doesnt-deploy-anything

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!