Skip to content
Advertisement

IntelliJ – External library recognized but build fails

I’ve been recently trying to build a Java project which looks as follows:

./someProject
./libForSomeProject

in ./someProject, I’m importing an interface and a class from ./libForSomeProject. I learned recently that in IntelliJ, one can make ./someProject aware of the ./libForSomeProject by adding it as an external library (project structure -> libraries etc.). Indeed, when I do this, the IDE seems to recognize the classes from ./libForSomeProject. However, when trying to build, it says that it could not find the libForSomeProject. Not sure what I’m doing wrong, as the classes seem to get recognized – if I’m not importing the ./libForSomeProject, they are “red” and marked as unknown (as they should be), so something is definitely being imported, but the build fails. Anyone seen something similar?

Thanks

Advertisement

Answer

One can put a library into the local maven repository, and then only use a maven dependency instead of adding it to IntelliJ IDEA’s libraries. Which is an other mechanism than maven’s.

For every IDE one must distinguish on its “native” conceived build/library handling and the way a build infrastructure like maven or gradle handle libraries aka dependencies.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement