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

后端 未结 6 1465
被撕碎了的回忆
被撕碎了的回忆 2021-01-31 22:07

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

相关标签:
6条回答
  • 2021-01-31 22:44

    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.

    0 讨论(0)
  • 2021-01-31 22:52

    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.

    0 讨论(0)
  • 2021-01-31 22:57

    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.

    0 讨论(0)
  • 2021-01-31 23:00

    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.

    0 讨论(0)
  • 2021-01-31 23:02

    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.
    0 讨论(0)
  • 2021-01-31 23:05

    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.

    0 讨论(0)
提交回复
热议问题