Maven Embedded Glassfish插件 - 如何设置临时目录?

时间:2010-04-25 17:41:45

标签: maven-2 glassfish maven-plugin glassfish-3 glassfish-embedded

我正在使用Maven Embedded Glassfish插件并且效果很好,但不幸的是它在我的主项目目录中创建了一个临时目录。我希望它能够使用目标,这样每次清理项目时,嵌入式目录也会被删除。

有设置吗?

沃尔特

2 个答案:

答案 0 :(得分:3)

更新:根据OP,所需参数实际为instanceRoot,而不是installRoot

我认为您可以使用 installRoot instanceRoot参数。将其设置为target目录:

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

答案 1 :(得分:0)

实际上,正确的方法是使用infuriatingly and partially undocumented glassfish.embedded.tmpdir System属性,并取消BootstrapProperties#setInstallRoot(String)BootstrapProperties#setInstanceRoot(String)方法的所有用法