Correctly configure the maven dependency of jstl and solve the jar package conflict.

Source: Internet
Author: User

Correctly configure the maven dependency of jstl and solve the jar package conflict.

It has been a headache for two days. Now we have a solution. In the end, I am not familiar with maven. I always complain that maven is not easy to use and there are various problems with no headers. These problems are due to lack of familiarity with it. It provides a good solution, but we usually do not know it.

Problem Background: Configure jstl dependencies,

<Dependency>
<GroupId> javax. servlet. jsp. jstl </groupId>
<ArtifactId> jstl-api </artifactId>
<Version> 1.2 </version>
</Dependency>
<Dependency>
<GroupId> org. glassfish. web </groupId>
<ArtifactId> jstl-impl </artifactId>
<Version> 1.2 </version>
</Dependency>

Please refer to this dependency, yes, it is the jstl jar package for you to complete the entire underground down, but it is actually attached to the jstl dependent jar package like servlet-api.jar, jsp-api.jar together down !!! So the question is, yes, most of your projects also need to use these two jar packages, and these two jar packages are needed. But do you know what the following is scary? I don't know how compatible the middleware version is for everyone. The two packages in my tomcat are in conflict with the packages under maven in my project !!! It seems that deleting the two packages in tomcat still does not work. Let's take a look at how to make reliable solution: From share: http://www.javacoder.cn /? P = 195

<Dependency>
<GroupId> javax. servlet. jsp. jstl </groupId>
<ArtifactId> jstl-api </artifactId>
<Version> 1.2 </version>
<Exclusions>
<Exclusion>
<GroupId> javax. servlet </groupId>
<ArtifactId> servlet-api </artifactId>
</Exclusion>
<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 </groupId>
<ArtifactId> servlet-api </artifactId>
</Exclusion>
<Exclusion>
<GroupId> javax. servlet. jsp </groupId>
<ArtifactId> jsp-api </artifactId>
</Exclusion>
<Exclusion>
<GroupId> javax. servlet. jsp. jstl </groupId>
<ArtifactId> jstl-api </artifactId>
</Exclusion>
</Exclusions>
</Dependency>

Dear friends, have you ever encountered the same distress as me? Please try it. If it can help you, I am also very happy !!!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.