Issue
In my code I have added the below in my settings.json file in the VS code java project still I don't see the referenced jar files added the project
"java.project.referencedLibraries": [
"library/**/*.jar",
"/home/username/lib/foo.jar"
]
Solution
You need to click the refresh
button then the added jar should be displayed under the option Referenced Libraries:
This is specified for no build tools project.
However, Maven project uses dependencies and there's a command called Maven: Add a dependency
provided by the extension Maven for Java, you can search needed dependencies then they will be added to pom.xml
.
About adding customized jars to maven project, you need to install the jar to local repository:
mvn install:install-file -Dfile=path\to\foo.jar '-DgroupId=com.example' -DartifactId=foo '-Dversion=1.0.0' -Dpackaging=jar
then add related dependency to pom.xml
:
<dependency>
<groupId>com.example</groupId>
<artifactId>foo</artifactId>
<version>1.0.0</version>
</dependency>
Detailed information about mvn install please view Apache Maven Install usage
Answered By - Molly Wang-MSFT
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.