I’m new to Maven. I recently learned it to solve some dependency issues I’m having with a Java and Spring WebApp. I’ve been trying maven out on a small sample webapp. The webapp uses JSTL tags. I found it necessary to put these tags in pom.xml:
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
<version>1.2-rev-1</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jstl-impl</artifactId>
<version>1.2</version>
</dependency>
These get 2 jars that I need:
jstl-api-1.2-rev-1.jar
jstl-impl-1.2.jar
BUT it also includes THIS jar in my WEB-INF/lib, the inclusion of which causes all sorts of errors when I try to run it in Tomcat 7:
jsp-api-2.1.jar
Is there a way I can rewrite my dependency tags to leave jsp-api-2.1.jar out of my WEB-INF/lib ?
Thanks
Fixed. Thanks Guys. FWIW, this is how I changed the dependency tags for the JSTL to not put the JSP-API jar in my WEB-INF lib:
<dependency>
<groupId>javax.servlet.jsp.jstl</groupId>
<artifactId>jstl-api</artifactId>
<version>1.2-rev-1</version>
<exclusions>
<exclusion>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>jstl-impl</artifactId>
<version>1.2</version>
<exclusions>
<exclusion>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
</exclusion>
</exclusions>
</dependency>
I was able to find the groupID and artifactID at this site
https://repository.sonatype.org/index.html#welcome
Have exclusions section, similar to the one below.
In your case, one (or both) of the dependencies you add include the one that you do not need. Find which one, and add the exclusion section.