2

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

vkraemer
  • 9,864
  • 2
  • 30
  • 44

2 Answers2

3

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>
Pascal Thivent
  • 562,542
  • 136
  • 1,062
  • 1,124
  • Thanks, but that doesn't change the gfembed temp directory. I am still looking to change that to target. Walter –  Apr 26 '10 at 00:21
  • instanceRoot was the setting I needed. –  Apr 26 '10 at 00:30
  • @Walter Wasn't 100% sure about the parameter (I guess I misunderstood the bottom note of [Installation Root Directory](http://docs.sun.com/app/docs/doc/821-1208/gikqf?a=view)). Thanks for the feedback, I've updated my answer accordingly. – Pascal Thivent Apr 26 '10 at 00:39
0

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.

Laird Nelson
  • 15,321
  • 19
  • 73
  • 127