Maven Embedded Glassfish Plugin - how to set the temporary directory?
-
01-10-2019 - |
Question
I am using the Maven Embedded Glassfish Plugin and it works great, but unfortunately it creates a temporary directory in my main project directory. I would like it to use target so that every time I clean the project, the embedded directory also gets wiped.
Is there a setting for that?
Walter
Solution
Update: According to the OP, the needed parameter is actually instanceRoot
, not installRoot
.
I think that you can use the installRoot
instanceRoot
parameter for this. Set it to the target
directory:
<plugin>
<groupId>org.glassfish</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<version>3.0</version>
<configuration>
<instanceRoot>${project.build.directory}</instanceRoot>
<goalPrefix>glassfish</goalPrefix>
<app>target/test.war</app>
<port>8080</port>
<contextRoot>test</contextRoot>
</configuration>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
OTHER TIPS
Actually, the correct way to do this is to use the infuriatingly and partially undocumented glassfish.embedded.tmpdir
System
property, and eliminate all usage of the BootstrapProperties#setInstallRoot(String)
or BootstrapProperties#setInstanceRoot(String)
methods.