Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 214
casolorz Avatar asked Dec 04 '25 01:12

casolorz


1 Answers

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.

like image 80
casolorz Avatar answered Dec 06 '25 15:12

casolorz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!