David Ferreira
David Ferreira

Reputation: 1786

Maven Dependencies or Eclipse Project Facet

I created a project in Eclipse (Oxygen) using maven with no archetype. My question is ... to use the Servlet API, if I use "Project Properties> Project Faces" and add "Dynamic Web Module", is it the same as adding the dependency in pom.xml of the Servlet API (javax. servlet-api)?

I mean...

Project Properties > Project Facets > Dynamic Web Module 4.0 (Checked)

Is the same as...?

<dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>javax.servlet-api</artifactId>
  <version>4.0</version>
  <scope>provided</scope>
</dependency>

Project Facets

Maven Dependency

Upvotes: 3

Views: 2887

Answers (2)

Jyoti Jadhav
Jyoti Jadhav

Reputation: 307

instead of

 <dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0</version>
<scope>provided</scope>

Go to Project properties > Project facets > click on runtimes which is in right side of Project Facets > checked that server >Apply and close

enter image description here

Upvotes: 0

Prathamesh Jagtap
Prathamesh Jagtap

Reputation: 403

Project facets allows IDE to understand your project better so that it can perform some special operations for you. For example, applying Dynamic Web Module would make eclipse know that your Project would be running on Web Server, hence you would need that facet to add your project to a Web Server. As you apply Dynamic Web Module to your project, eclipse also assumes that you would be provided with web server dependencies in the run time. Facets stays at IDE level.

While maven dependency provides you with the libraries required in your project to perform your task. They stay with your project package when it is deployed.

Upvotes: 1

Related Questions