I will give those steps a shot today and let you all know if I run into any problems. It sounds like a pretty logical thing to do actually, and fortunately I do not require cross-platform compilation and support at this point. One quick question though, when you say that I should use the dependency plugin to copy the DLL's to the target directory or other suitable location, could I specify that the DLL's be put inside the jar? (that is, in the resources folder).
Thanks! On Mon, Jun 16, 2008 at 15:37, Kalle Korhonen <[EMAIL PROTECTED]> wrote: > If you don't need to worry about cross-platform compilation & support (and > sounds like you don't), the most straight-forwarded way to do this is to > deploy your dll to a Maven repository with type "dll", declare a > straight-up > dependency to it in your pom and then use the dependency plugin to copy the > lib to the target dir or other suitable location for development > environment > and structure you assembly (or whatever is the format of the actual > delivery) similarly. If cross-platform support is desired, nar plugin ( > http://java.freehep.org/freehep-nar-plugin/intro.html) is a bit more > involving but simplifies things greatly. However, using it requires some > code changes. > > Kalle > > > On Mon, Jun 16, 2008 at 11:19 AM, Mikel Cármenes Cavia <[EMAIL PROTECTED]> > wrote: > > > Hey guys, > > I need to include three DLL's in my Maven project. Prior to deciding to > > email the list, I have looked around the archives, and haven't been able > to > > find anything that would seem to answer my problem (which is a very easy > > one > > in nature). > > > > I use JNA to interface with two of the three DLL's (the third one is for > > Jacob, and its location needs to be set as a system variable). > > > > In Java, I do the following: > > > > URL libURL = this.getClass().getResource("/org/git/systems/DLLs/"); > > System.setProperty("jna.library.path", libURL.getPath()); > > > > And then declare the following interface > > > > public interface CurviLibrary extends Library { > > CurviLibrary CurviInitialization = (CurviLibrary) > > Native.loadLibrary("Curvi",CurviLibrary.class); > > CurviLibrary OptimizedSolver = (CurviLibrary) > > Native.loadLibrary("OptimizedSolver",CurviLibrary.class); > > DoubleByReference GIT_CURVIG(float[] timeData, float[] rawData, float[] > > relax, int rawDataSize, double alphaValue, > > long numberOfBins); > > } > > > > So when compiled via Eclipse, this works like a charm. I have tried > placing > > the DLL's within /main/resources/org/git/systems/DLLs but this does not > > seem > > to work, as the jar looks in > > > > > file:/C:/DEV/Maven/GITSYSTEMS/target/GITSYSTEMS-1.0-jar-with-dependencies.jar!/org/git/systems/DLLs/ > > which would make sense, if only a jar wasn't a package. > > > > How may I go about adding these DLLs to my Maven project, without having > to > > modify the existing Java code? > > > > I am assuming they will have to go outside of the jar, but I am unsure as > > to > > how to reference and go from there. > > > > Thanks guys! > > >
