casolorz
casolorz

Reputation: 9604

Why does gradle-7.4-bin.zip prevent me from using javax.servlet?

Afer updating Android Studio to Electric Eel I updated my gradle-wrapper.properties to use gradle 7.5:

distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip

And also my gradle files to:

classpath 'com.android.tools.build:gradle:7.4.0'

When I did that, all my imports of javax.servlet stopped working.

If I revert back to gradle-7.4-bin.zip then the imports work just fine.

What is different about gradle-7.5-bin.zip and do I need to worry about it for future releases?

The javax.servlet dependency I believe comes from:

api 'org.eclipse.jetty:jetty-server:8.1.12.v20130726'
api 'org.eclipse.jetty:jetty-servlet:8.1.12.v20130726'

Do I need to change how I add that?

Edit: It was mentioned on a comment that mixing 7.5 and 7.4 was probably not right but that is what Android Studio suggests:

enter image description here

Edit: Even adding implementation 'org.eclipse.jetty.orbit:javax.servlet:3.0.0.v201112011016' doesn't add the javax.servlet packages.

Upvotes: 3

Views: 693

Answers (1)

casolorz
casolorz

Reputation: 9604

I think I found a solution though I still don't understand the issue.

Jetty 8.1.12 comes with:

org.eclipse.jetty.orbit:javax.servlet:3.0.0.v201112011016

If I use javax.servlet:javax.servlet-api:3.0.1 instead then it works fine.

Upvotes: 3

Related Questions