2

I've recently started trying to convert an application to use wildfly swarm, I'm on Windows, using maven, and am using the wildfly swarm maven plugin to: create the uber jar, start it up for integration tests and stop at the end of the build.

Here's a snippet from the pom:

<plugin>
    <groupId>org.wildfly.swarm</groupId>
    <artifactId>wildfly-swarm-plugin</artifactId>
    <version>${version.wildfly.swarm}</version>
    <configuration>
        <useUberJar>true</useUberJar>
        <debug>8000</debug>
    </configuration>
    <executions>
        <execution>
            <id>swarm-package</id>
            <phase>package</phase>
            <goals>
                <goal>package</goal>
            </goals>
        </execution>
        <execution>
            <id>swarm-start</id>
            <phase>pre-integration-test</phase>
            <goals>
                <goal>start</goal>
            </goals>
        </execution>
        <execution>
            <id>swarm-stop</id>
            <phase>post-integration-test</phase>
            <goals>
                <goal>stop</goal>
            </goals>
        </execution>
    </executions>
</plugin>

I additionally use mvn wildfly-swarm:run from the command line to start up the application so I can do some manual testing outside of the maven build.

Each time I run the build, C:\Users\myusername\AppData\Local\Temp is filling up with large amounts of data that never seems to be torn down. I'm having to clear down my Temp directory manually every few builds as it's eating up all of my disk space.

Is there something that I'm missing? Is it possible to place all this temp data into the project target directory so it can be deal with using mvn clean?

Martin Cassidy
  • 686
  • 1
  • 9
  • 28

1 Answers1

1

Similar issue has been reported at a forum here.

In your case specifically, the problem could be caused by the manual intervention in the start and stop of the swarm process.

From the linked source:

Right now, the only thing I can think is that for some reason the JVM is exiting in an unclean manner, which is why the delete hook is not executing.

You might want to execute and test using

mvn wildfly-swarm:start 

and once done testing

mvn wildfly-swarm:stop

which shall ensure the proper cleanup.

Note: This would be different then package or install command and would not follow the plugin execution you have otherwise specified.

Naman
  • 27,789
  • 26
  • 218
  • 353
  • I have previously tried using `mvn wildfly-swarm:stop` from the command line, but it isn't supported, it produces the error `wildfly-swarm:stop is not usable from the CLI` which is why I added the execution in the POM instead. – Martin Cassidy Aug 25 '17 at 11:49
  • @MartinCassidy For some reason's that seems intentional. The [implementation](https://github.com/wildfly-swarm-archive/wildfly-swarm/blob/master/plugin/src/main/java/org/wildfly/swarm/plugin/maven/StopMojo.java) and the [confirmation](https://groups.google.com/d/msg/wildfly-swarm/WQrbqf_oYCI/dVnM874aAQAJ) links to it. – Naman Aug 25 '17 at 11:56
  • 1
    I suspect that's for practical reasons, it needs to be part of the same maven process that started swarm, so that the stop command knows which process to actually stop. I have actually tried out the `java -jar` option which is producing the same problem. I've raised a ticket for it https://issues.jboss.org/browse/SWARM-1530 In the meantime, I've added `-Djava.io.tmpdir` as a `jvmArgument` in the maven swarm plugin configuration, setting it to my `/target` directory so that `mvn clean` is now taking care of things. – Martin Cassidy Aug 30 '17 at 11:45