无法在VS Code中使用外部jar

时间:2018-12-10 06:54:53

标签: java spring-boot visual-studio-code

我已经用maven在VS Code中创建了spring-boot项目。我将使用oracle.jdbc.driver.OracleDriver连接到oracle数据库。在Intellij Idea中, 右键单击我曾经单击过add as library的jar即可完成。

在Visual Studio代码中,我已在ojdbc8.jar的{​​{1}}中添加了路径,如this github问题所示,但我又得到了.classpath

enter image description here

1 个答案:

答案 0 :(得分:2)

在maven项目中,所有依赖项均由pom.xml处理。我们可以使用Maven存储库下载依赖项,也可以从本地目录中添加依赖项。将jar安装到本地Maven存储库中可以完成以下操作。

 mvn install:install-file \
-Dfile=<path-to-file> \
-DgroupId=<group-id> \
-DartifactId=<artifact-id> \
-Dversion=<version> \
-Dpackaging=<packaging> \
-DgeneratePom=true

参考-http://maven.apache.org/general.html#importing-jars