0

I have this situation in pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
                        https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.jsf</groupId>
    <artifactId>showcase</artifactId>
    <version>1.0.0</version>
    <packaging>war</packaging>

    <name>showcase</name>
    <url>http://maven.apache.org</url>

    <repositories>
        <repository>
            <id>prime-repo</id>
            <name>Prime Repo</name>
            <url>http://repository.primefaces.org</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>7.0</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.weld.servlet</groupId>
            <artifactId>weld-servlet-shaded</artifactId>
            <version>3.1.3.Final</version>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>8.0.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>jakarta.faces</artifactId>
            <version>2.3.14</version>
        </dependency>
        <dependency>
            <groupId>jakarta.servlet.jsp.jstl</groupId>
            <artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
            <version>1.2.7</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.10</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.2.3</version>
                <configuration>
                    <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

When is:

<dependency>
    <groupId>jakarta.el</groupId>
    <artifactId>jakarta.el-api</artifactId>
    <version>3.0.3</version>
    <scope>provided</scope>
</dependency>

Useful?
I have tried with and without this dependency in my pom.xml and nothing changes. In my case, in both cases everything works correctly. Is there any case in which the lack of this dependency generates an error?
...........................................

Mario Palumbo
  • 693
  • 8
  • 32
  • Remove it and try to build and see what happens. See also https://stackoverflow.com/questions/26975818/what-is-scope-under-dependency-in-pom-xml-for – Jasper de Vries Feb 11 '20 at 14:05
  • In my pom this dependency is not there and everything works correctly in my case. Is there any case in which the lack of this dependency generates an error? – Mario Palumbo Feb 11 '20 at 14:11
  • Yes, if it is not already present via another dependency and it is needed... during test, during runtime... etc... Just like any other dependency... The EL api is provided via the ` javaee-web-api`... And depending on where you run, you include too many impls of things to ( servlet, jsp, jsf(?)) – Kukeltje Feb 11 '20 at 14:25
  • in the pom.xml of the primefaces 7.0 library a version less recent of this dependency is there. – Mario Palumbo Feb 11 '20 at 14:32
  • Yes and? If PF itself does not require a newer version for compiling and testing that is perfectly fine... Happens in many projects. And most likely it is 'test' scope or 'provided' – Kukeltje Feb 11 '20 at 14:59

1 Answers1

3

It's indeed already covered by javaee-web-api. It's only useful during working in an IDE if the target server actually uses it, and it's in pom declared before the javaee-web-api. When done so, then you will in the IDE:

  • See javadocs from that API during code autocomplete
  • See source code from that API during debug-stepping into the API classes

And even then it will be only useful if it actually contains improvements/fixes as compared to the ones in javaee-web-api. But when it's declared after the javaee-web-api in pom, then the ones in javaee-web-api will be used instead, and you might see the wrong javadocs and/or source code as compared to the ones used by the target server while working in the IDE. In such case the child API (be it EL API, or Servlet API, or JSF API, or whatever else), will indeed become utterly useless in pom.

See also:


Unrelated to the concrete problem, the javaee-web-api has been migrated to jakarta.jakartaee-web-api. Update your pom accordingly.

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555