开发者

Need a good "home" directory for web-app during Maven build

I have a Java web application that uses JNDI to determine its "home" directory where various configuration files and logging takes place. During a Maven build, we set the home directory location in a property that is located in settings.xml. This property in turn gets put into the Jetty/Tomcat JNDI file during the build by Maven resource filtering. Everything works great.

However, this set up requires that only one Maven build can happen on a machine at a time, which will be a problem soon for our Hudson CI server. It also requires that users create this directory ahead of a build, which helps to break build portability. Ideally I could use the开发者_开发问答 "target" directory of the parent POM project as the "home" directory by defining a variable in the parent POM:

<webapp-home>${project.basedir}/target<webapp-home>

But this doesn't work because each Maven module redefines webapp-home to be something different. I have no idea why. If I could solve THAT problem, I'd be all set.

Otherwise, what can I use as a good temporary "home" or "working" directory, that is unique to a build and is constant across all Maven modules in the build? And the bonus question is: Can I have Maven create the directory for me if it doesn't exist?


We're using a global "out" directory as webapp-home, with subfolders for every project

<properties>
  <root.dir>${basedir}/..</root.dir>
  <output.dir>${root.dir}/out</output.dir>
  <output.wardir>${output.dir}/wars</output.wardir>
</properties>
...
<plugin>
  <artifactId>maven-war-plugin</artifactId>
  <configuration>
    <webappDirectory>
      ${output.wardir}/exploded/${project.artifactId}
    </webappDirectory>
   </configuration>
</plugin>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜