I would like to add external java libraries to a Maven project using intellij. I followed previous discussions in stackoverflow but none of those work for me. I added jar files to the libraries and source code can detect them but when I try to compile my project (mvn package), it gives me "cannot find symbol" error.
Asked
Active
Viewed 979 times
0
-
Have you specified these libraries as dependencies in Maven pom.xml file? – Andrey Nov 26 '18 at 07:29
1 Answers
0
if you want to add external jar you can use system scope . Like:
<dependency>
<artifactId>..</artifactId>
<groupId>..</groupId>
<scope>system</scope>
<systemPath>${basedir}/lib/dependency.jar</systemPath>
</dependency>
its not suggested but you can also install your jar in the repository.
mvn install:install-file \
-Dfile=<path-to-file> \
-DgroupId=<group-id> \
-DartifactId=<artifact-id> \
-Dversion=<version> \
-Dpackaging=<packaging> \
-DgeneratePom=true

i.karayel
- 4,377
- 2
- 23
- 27