External library/dependency cannot be found during build

During build it get this error in Cuba Studio;

C:\Workspace\JediAdmin2\modules\core\src\com\jsonedi\jediadmin\service\SourceSchemaWizardServiceBean.java:6: error: package org.apache.commons.dbcp2 does not exist
import org.apache.commons.dbcp2.BasicDataSource;

Line 6: import org.apache.commons.dbcp2.BasicDataSource;

I see the library in “External Libraries” and the jar in explorer etc. I Invalidated cache/restarted studio.


What CUBA version do you use?

How have you attached dependency to commons-dbcp2 library to your project?

Sometimes gradle project model and IDEA (CUBA Studio is based on IDEA) model can go out of sync. Especially if you try add library from the Project Settings Dialog - you should not do that if your project is based on gradle script.

Take a look into Studio manual about adding library dependencies: