Maven Dependency for Servlet 3.0 API

Maven dependency for Servlet 3.0 API?

I'd prefer to only add the Servlet API as dependency,

To be honest, I'm not sure to understand why but never mind...

Brabster separate dependencies have been replaced by Java EE 6 Profiles. Is there a source that confirms this assumption?

The maven repository from Java.net indeed offers the following artifact for the WebProfile:

<repositories>
<repository>
<id>java.net2</id>
<name>Repository hosting the jee6 artifacts</name>
<url>http://download.java.net/maven/2</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

This jar includes Servlet 3.0, EJB Lite 3.1, JPA 2.0, JSP 2.2, EL 1.2, JSTL 1.2, JSF 2.0, JTA 1.1, JSR-45, JSR-250.

But to my knowledge, nothing allows to say that these APIs won't be distributed separately (in java.net repository or somewhere else). For example (ok, it may a particular case), the JSF 2.0 API is available separately (in the java.net repository):

<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.0-b10</version>
<scope>provided</scope>
</dependency>

And actually, you could get javax.servlet-3.0.jar from there and install it in your own repository.

How do I include javax.servlet servlet-api 3.0.1 in my Maven project?

Look at the pom of spring-test-4.0.6.RELEASE: http://search.maven.org/#artifactdetails|org.springframework|spring-test|4.0.6.RELEASE|jar

It actually depends on the following:

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>

How to config maven to use servlet 3

Your options are actually 3.0.1 or 3.1.0 of the final releases, and the artifact ID has been changed. Using the old servlet-api artifact ID, the releases available are only 2.x, aside from the alpha you've found.

If you update to javax.servlet-api, you'll find the newer 3.x releases:

http://mvnrepository.com/artifact/javax.servlet/javax.servlet-api

You can update your POM to use:

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

Maven dependency for Servlet 3.0 API?

I'd prefer to only add the Servlet API as dependency,

To be honest, I'm not sure to understand why but never mind...

Brabster separate dependencies have been replaced by Java EE 6 Profiles. Is there a source that confirms this assumption?

The maven repository from Java.net indeed offers the following artifact for the WebProfile:

<repositories>
<repository>
<id>java.net2</id>
<name>Repository hosting the jee6 artifacts</name>
<url>http://download.java.net/maven/2</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

This jar includes Servlet 3.0, EJB Lite 3.1, JPA 2.0, JSP 2.2, EL 1.2, JSTL 1.2, JSF 2.0, JTA 1.1, JSR-45, JSR-250.

But to my knowledge, nothing allows to say that these APIs won't be distributed separately (in java.net repository or somewhere else). For example (ok, it may a particular case), the JSF 2.0 API is available separately (in the java.net repository):

<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.0-b10</version>
<scope>provided</scope>
</dependency>

And actually, you could get javax.servlet-3.0.jar from there and install it in your own repository.

How to download servlet 3 dependency that works with tomcat 7

Looks like artifact ID has been renamed to javax.servlet-api

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

Here is the search URL on maven central: http://search.maven.org/#search|gav|1|g%3A%22javax.servlet%22

To preempt your question about JSP and EL, here are the dependencies for jsp-api and el-api:

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

<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>2.2.2</version>
<scope>provided</scope>
</dependency>

Warning when declaring pom dependency for servlet 3.1.0 in Spring 4.3.2

Look at you repository to see the content of the folder M2_REPO/javax/servlet/javax.servlet-api/3.1.0/.

The warning means that you probably have a jar inside but no POM. There was probably an issue when downloading that dependency since it is available in Maven Central Repository.

You can try to:

  1. re-compile your project with -U option to force Maven to update
  2. re-compile your project after deleting folder M2_REPO/javax/servlet/javax.servlet-api/3.1.0/.


Related Topics



Leave a reply



Submit