views:

68

answers:

6

In the past, I've only developed Java applications. This is my first time attempting an actual web app on my own, so pardon the painfully rookie question.

Should I add the WEB-INF/web.xml file to version control? It appears to be a generated file, so my instinct is to add it to the ignore list, but I thought I'd ask and make sure.

Thanks!

+1  A: 

Generally, web.xml should be under version control. And it is not usually generated.

If you are using some "clever" utility to generate the web.xml, then don't put it in version control. But:

  • your build process should include the generation as well - your app won't run without this file

  • I'd advise against web.xml generation. At minimum there should be a template web.xml to which the generator appends.

Bozho
A: 

it should be. it is where you do configure your web application.

Reddy
A: 

The web.xml file is the configuration file for your web application.

Since your application can't work without a proper web.xml file, you should put it in your version control system.

Vivien Barousse
+2  A: 

On a more general point, anything that is considered "source" should be kept in source control. This includes:

  • Code (excluding generated code)
  • Configuration files (excluding generated config)
  • Run scripts
  • Database schema definitions and objects (stored procedures, triggers, etc)
  • IDE configurations for compiler settings, formatting, etc
  • Scheduling definition files
  • Environment source files

If it's required for your application to work, and you don't generate it as part of your build process, put it in source control.

stark
+3  A: 

Your IDE has probably generated a sample web.xml file, which you will edit as your application expands. If this is the case, then it is definitely something you want to keep in source control.

As has been said in other answers, if you are actually using some web.xml generating tool, then keep that tool's configuration in source control, and fire the tool up during your build process.

Robert Grant
You hit it right on the head, Robert. That's exactly what happened.
Syndog
A: 

If the file can be regenerated completely based on information which is present in your source control system, then No. Otherwise Yes.

If you can regenerate it, then better document or automate how.

Thorbjørn Ravn Andersen