How to add gradle jsp-api

How can i add the following jar file
https://mvnrepository.com/artifact/javax.servlet.jsp/jsp-api/2.2.1-b03
to my gradle project?

I tried to add the repositories as mavenCentral() and dependencies as

provided group: ‘javax.servlet.jsp’, name: ‘jsp-api’, version: ‘2.2.1-b03’

But this did not work out at all. As a gradle newbie i am hoping for someone who can show me the correct way of doing this.

Thanks in advance

Gradle doesn’t have a built-in provided configuration as shown in example on https://mvnrepository.com/.

The correct dependency declaration depends what you’re trying to do with this dependency. If you’re building a war with the war plugin, use providedCompile. Otherwise, compileOnly might be most appropriate, unless you’re doing something unusual with this dependency.

Can you give an example on how i would do this with providedCompile to add the javax.servlet.http.HttpServlet-api jar? I have no idea myself

You just need to declare the dependency on the correct configuration. The mvnrepository.com examples are just using a template. They don’t take into consideration that the correct configuration might actually be different in the build tool. They also show the longer map form, group: 'javax.servlet.jsp', name: 'jsp-api', version: '2.2.1-b03', which can be shortened to 'javax.servlet.jsp:jsp-api:2.2.1-b03'.

apply plugin: 'war'
  
repositories {
    mavenCentral()
}

dependencies {
    providedCompile group: 'javax.servlet.jsp', name: 'jsp-api', version: '2.2.1-b03'
    // -- OR ---
    providedCompile 'javax.servlet.jsp:jsp-api:2.2.1-b03'
}

Thanks for your reply @jjustinic!
I am fresh out of the fire to learn Gradle so i really appreciate your feedback and help