简体   繁体   中英

New Gradle dependency not added to project and external dependencies (VSCode)

I've been having this issue on and off for the past few weeks after beginning to learn how to use Gradle.

I added the dependency to my build.gradle file

compile group: 'org.apache.xmlgraphics', name: 'batik-all', version: '1.12', ext: 'pom'

I used VSCode's command palette to "refresh", cleaned the server workspace and ran gradle build but the new dependency does not show up in my "Project and External Dependencies" and I cannot import org.apache.batik.*

Hoping to find a fix for this in VSCode as I have seen some other IDE specific fixes.

So the issue was that in the map notation you were specifying the ext: 'pom' part. This effectively told Gradle to only import the POM file and not treat the dependency as a regular one.

When you moved to the different notation, you did not keep that pom element in the coordinates and so you got the right behaviour.

Note: compile has been replaced by implementation for a while now and is even deprecated in Gradle 6.x. Have a look at the documentation for more information on this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM