What is the difference between Java projects having pom.xml and web.xml? Can projects have both these configurations at the same time?
6 Answers
They're completely compatible. As a matter of fact, they perform completely unrelated tasks.
pom.xml
is the configuration file for Maven projects. One of its goals is to provide assistance in the compilation and building of a project when using Maven. You can think of it as an ant build.xml
file or a makefile
Make file if you're not familiar to Maven (actually, it can provide a lot more functionality)
web.xml
is the Java EE web application deployment descriptor, where you specify for instance servlets, servlet mappings and other aspects of a webapp.
- What is Maven from the Apache Maven site.
- What is web.xml file and what all things can I do with it? question on SO.

- 1
- 1

- 27,550
- 11
- 97
- 161
The two files have nothing to do with each other.
- pom.xml - Maven configuration file. Controls the build process for the project
- web.xml - Web application configuration file. Controls the deployment and configuration of the web application
The POM file really shouldn't be deployed with the application, its just for the build process.

- 79,279
- 19
- 185
- 195
web.xml
is an indicator that the project is running in some kind of servlet container (possibly even a full-fledged Java EE container).
pom.xml
is an indicator that the project is built using the Maven build system.
Those two things are entirely orthogonal, so any given project can have none, one or both of them.

- 37,782
- 12
- 108
- 140

- 302,674
- 57
- 556
- 614
The Pom defines any dependancy libraries, it is part of Maven. This tells maven what jar files to download and store in the lib folder of your site.
Web xml is how your web project is configured.
They can both coexist as they do different things.

- 1,974
- 15
- 23
-
Hi @Davos555, where do I copy this code
org.springframework.boot spring-boot-starter-remote-shell -
1POM as this is used by Maven to find the dependencies you need. – Davos555 Jan 15 '15 at 16:08
POM stands for "Project Object Model". It is an XML representation of a Maven project held in a file named pom.xml. http://maven.apache.org/pom.html
yes you can have both configurations at the same time.

- 1,677
- 11
- 18
The pom.xml is for configure your project with Maven.
The web.xml is use in all Java EE project under Tomcat for example.
You can use both, Maven is for compile and deploy your project, Tomcat is your server.

- 665
- 4
- 19
-
2`web.xml` is use for ever project that uses a servlet container. That's **not** specific to Tomcat. – Joachim Sauer Apr 19 '12 at 11:45