Forums de discussion

Maven - Servlet and JSP API versions

thumbnail
Nicolas Juneau, modifié il y a 9 années.

Maven - Servlet and JSP API versions

New Member Publications: 4 Date d'inscription: 30/12/14 Publications récentes
Hello fellow Liferay developers,

I have a question regarding Liferay's dependencies to some Java EE APIs. In Liferay 6.2, when I create a project using one of Liferay's Maven archetypes, the following dependencies are in place in the pom.xml:

* Servlet API 2.4
* JSP API 2.0

I haven't tried all of Liferay's bundles, but Tomcat 7 and JBoss AS 7 both implement parts of the Java EE 6 API. Following the Java EE 6 spec (http://www.oracle.com/technetwork/java/javaee/tech/javaee6technologies-1955512.html), the Servlet API and JSP API versions should be:

* Servlet API 3.0
* JSP API 2.2 / EL API 2.2

If I look into the JARs bundled in Liferay's source code (there are many so I may have the wrong one here), the versions are as follows:

* JSP API 2.1
* Servlet API 3.0

I have read a bug report which mentions that using a different JSP implementation than the one that Liferay use may cause problems (https://issues.liferay.com/browse/LPS-47682).

The problem is : The generated Maven artifact, the application server (Tomcat and JBoss AS) and Liferay use different versions of the JSP API (2.0, 2.2, 2.1) and, for the Maven artifact and Liferay, different Servlet versions (2.4, 3.0).

My question is, which should be the definitive API versions to use? Because from what I see here, either I have to pick a version that differs from the application server's, or one that differs from Liferay's.
Illia Izotov, modifié il y a 9 années.

RE: Maven - Servlet and JSP API versions

New Member Publications: 16 Date d'inscription: 10/09/12 Publications récentes
It is really important question ! Are there any answers ?
thumbnail
Nicolas Juneau, modifié il y a 9 années.

RE: Maven - Servlet and JSP API versions

New Member Publications: 4 Date d'inscription: 30/12/14 Publications récentes
I have not yet received any response. I am sometimes going to the IRC channel to see if there are any Liferay/Maven users, but no luck for the moment. If I come across the answer outside the forum, however, I'll make sure to update this post.
thumbnail
David H Nebinger, modifié il y a 9 années.

RE: Maven - Servlet and JSP API versions

Liferay Legend Publications: 14914 Date d'inscription: 02/09/06 Publications récentes
Sorry, didn't see this come up when posted.

As the APIs tend to be backwards compatible, you are probably fine to use newer versions. I think for the most part the issues you run into would be using a different JSP version while trying to use the Liferay/AUI tag libraries.

My recommendation would be to stick with the Liferay versions whenever you can. At the end of the day you're trying to code new plugins, not make Liferay compatible with a new JSP API version for some nebulous reason.

Liferay's full of jars which are simply out of date. When you look in ROOT/WEB-INF/lib, the list is long - Spring 3.0.7, etc. You could make yourself quite busy trying to upgrade them all...

I think Liferay's perspective is that they are interested more in platform stability. Updating a dependency jar may require an update to code/beans/properties/other dependencies, ... And when dependencies of the portal change, during upgrades we'd have more work to do to upgrade our plugins. A simple dot version upgrade, i.e. from GA2 to GA3, would turn into a significant project.
thumbnail
Nicolas Juneau, modifié il y a 9 années.

RE: Maven - Servlet and JSP API versions

New Member Publications: 4 Date d'inscription: 30/12/14 Publications récentes
You don't have to be sorry - I am fully aware that this is a community forum and I don't have any requirements regarding response time, neither do you have an obligation to respond quickly. I am grateful that people are helping out emoticon .

To be clear, I am not trying to make Liferay compatible with newer library versions. I am trying to be consistent in my projects' choice of dependencies. From what I see then, there is definitely an error in Liferay's Maven archetypes. Here's what I extracted from Liferay 6.2 EE source bundle:

* Servlet API 3.0.1
* JSP API 2.1
* JSTL API 1.2

And, as I mentioned earlier, the Maven archetypes specify:

* Servlet API 2.4
* JSP API 2.0
* JSTL is not part of the archetype

So, to be consistent with Liferay, the archetype should put, by default, Servlet 3.0 and JSP 2.1. Maybe I should open a ticket for that.

Now, regarding the choice of versions... Liferay makes use of Servlet 3 and JSP API 2.1. The problem, is, Servlet 3 and JSP 2.1 belong to two different Java EE specifications (6 and 5, respectively). It is highly unlikely that you will find an application server implementing these two versions together. An application server following the Java EE 6 specification would use Servlet 3 along JSP 2.2. An application server following the Java EE 5 specification would use Servlet 2.5 along JSP 2.1. It would be interesting to know if JSP was left to 2.1 because it was "forgotten" or if it was intentionally left to 2.1.
thumbnail
David H Nebinger, modifié il y a 9 années.

RE: Maven - Servlet and JSP API versions

Liferay Legend Publications: 14914 Date d'inscription: 02/09/06 Publications récentes
More likely it was "pick the spec that has the necessary stuff so our XML file works" emoticon

Actually, though, Liferay is certified to work across a wide variety of app servers. A better guess is that the versions listed represent the "least common denominator" of what the servers would support and what Liferay requires to function.
thumbnail
Nicolas Juneau, modifié il y a 8 années.

RE: Maven - Servlet and JSP API versions

New Member Publications: 4 Date d'inscription: 30/12/14 Publications récentes
Just as a follow-up on this, I opened a ticket regarding the version mismatch - the ticket is MAVEN-145 . Thanks for your comments!