Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between web projects with pom.xml and web.xml

What is the difference between Java projects having pom.xml and web.xml? Can projects have both these configurations at the same time?

like image 781
TechSpellBound Avatar asked Apr 19 '12 11:04

TechSpellBound


People also ask

What is the difference between POM xml and Web xml?

The pom. xml is for configure your project with Maven. The web. xml is use in all Java EE project under Tomcat for example.

What is project POM xml?

A Project Object Model or POM is the fundamental unit of work in Maven. It is an XML file that contains information about the project and configuration details used by Maven to build the project. It contains default values for most projects.

Is there a POM file for every project?

It should be noted that there should be a single POM file for each project. All POM files require the project element and three mandatory fields: groupId, artifactId, version. Projects notation in repository is groupId:artifactId:version.

What is Web xml in Maven?

In Java web applications, web. xml is the standard name of the deployment descriptor. We can create a web application using Maven or a dynamic web project using Eclipse. Eclipse doesn't create the default deployment descriptor web. xml under the WEB-INF/ directory.


1 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.
like image 79
Xavi López Avatar answered Oct 05 '22 06:10

Xavi López