I'm working on a Griffon app, using IntelliJ, and I'm trying to use the dcm4che project libraries. I've managed to get IntelliJ's code editor to stop complaining about missing classes, but when I go to run the Griffon app, the compiler goes down in flames, complaining that it is unable to resolve class DicomInputStream
, etc.
I'm not doing anything fancy. All I'm doing is trying to include a few simple jar files, but for whatever reason, things are not working correctly.
I admit, I'm not particularly well versed in dealing with classpath issues, and I've only been using IntelliJ for a little while, and Griffon / Groovy for even less time, but I'm completely stumped.
Here's the set of import statements that fail:
import org.dcm4che2.io.DicomInputStream
import org.dcm4che2.data.DicomObject
import org.dcm4che2.data.DicomElement
And this is the set of error messages I get in the IntelliJ console when I try to run or debug the app:
Base Directory: C:\Users\[REDACTED]\MyApp\MyAppClient
Resolving dependencies...
Dependencies resolved in 698ms.
Running script C:\Program Files (x86)\Griffon\Griffon-0.9.4\scripts\RunApp.groovy
Environment set to development
[griffonc] Compiling 32 source files to C:\Users\[REDACTED]\.griffon\0.9.4\projects\MyApp\classes
[griffonc] org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
[griffonc] C:\Users\[REDACTED]\MyApp\MyAppClient\griffon-app\controllers\myappclient\SelectRootController.groovy: 9: unable to resolve class org.dcm4che2.data.DicomElement
[griffonc] @ line 9, column 1.
[griffonc] import org.dcm4che2.data.DicomElement
[griffonc] ^
[griffonc]
[griffonc] C:\Users\[REDACTED]\MyApp\MyAppClient\griffon-app\controllers\myappclient\SelectRootController.groovy: 7: unable to resolve class org.dcm4che2.io.DicomInputStream
[griffonc] @ line 7, column 1.
[griffonc] import org.dcm4che2.io.DicomInputStream
[griffonc] ^
[griffonc]
[griffonc] C:\Users\[REDACTED]\MyApp\MyAppClient\griffon-app\controllers\myappclient\SelectRootController.groovy: 8: unable to resolve class org.dcm4che2.data.DicomObject
[griffonc] @ line 8, column 1.
[griffonc] import org.dcm4che2.data.DicomObject
[griffonc] ^
[griffonc]
[griffonc] 3 errors
Compilation error: Compilation Failed
To install the dcm4che libraries, I did the following:
MyApp\MyAppClient\lib\dcm4che-2.0.25-bin
MyAppClient\lib\dcm4che-2.0.25-bin\dcm4che-2.0.25\lib
At this point, the code editor stops complaining about not being able to find and resolve the classes, but when I run or debug the application, I get the compilation errors. Everything works just fine without importing those classes (and the code that uses them).
What can I do to resolve this? What other info would be helpful to figure out what is going on?
As Peter suggests, either you configure the library as a dependency using the dependency DSL (if it's available from a maven or ivy repo) or place it inside MyApp/lib (no additional sub directories). Those are the conventions set by Griffon.