开发者

Should I commit WEB-INF into version control, or rather construct it with Ant?

The Ant "war" task does just that - creates WEB-INF along with META-INF, depending on task attributes.

What is considered a best practice? Keeping all my libs elsewhere for re-use, like log4j and then build th开发者_如何学编程em with "war" task? Or have everything (including jars) checked-in under WEB-INF? I have multiple apps that could re-use same libs, images, htmls, etc. Our developers use RAD7/Eclipse.

I'd appreciate any examples with opensource Java Web Apps repo layouts.


If you can reliably, dynamically create it, the don't check it in. That's going to cause confusion. In this situation it's analogous to checking in .class files.

Rather, check in the build file and the artifacts you use to create it, and let the build take care of it.


I'd appreciate any examples with opensource Java Web Apps repo layouts.

Here's an example of web application which is using a classic Maven directory layout:

hifaces20-demo-messageboard-0.1.0-project.zip

src
  main
    java
    resources
    webapp
      WEB-INF
        web.xml
  test
    java
    resources
pom.xml


We work with Eclipse. I have found that having the files that Eclipse do not hide checked in work well for us. You check out the project, and you are ready to go. No further ant stuff to run or remember to run.

If you build with ant always (e.g. if you come from a Netbeans shop) then check in only those files which are original. All those that are copied from elsewhere, should explicitly be not checked in.


I generally do check in the WEB-INF folder but exclude the lib and classes folder. When I need the libs I retrieve them using Maven or Ivy (ant tasks). Seems to work well, I only check in the libs if it's an extreme case where it's likely I wont have an Ivy cache or the lib is 'special' and doesn't exist anywhere else.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜