You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Mikel Cármenes Cavia <mi...@gmail.com> on 2008/06/16 20:19:43 UTC
Incorporating DLL's into Maven Project.
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!
Re: Incorporating DLL's into Maven Project.
Posted by Andrew Hughes <ah...@gmail.com>.
Did you get this working Mike, I have the same issue... I need a dll on the
java.libraray.path. I've installed this in the repo, and I've also got it in
./src/main/resources... but System.loadLibrary("my-native-code"); barfs with
an unlinked error everytime!
On Wed, Jun 18, 2008 at 10:41 PM, Mikel Cármenes Cavia <mi...@gmail.com>wrote:
> I'm lost with this DLL business... What pains me the most is that I'm sure
> it's quite the trivial thing to do, but I can't seem to figure it out...
> Mikel
>
> On Tue, Jun 17, 2008 at 15:31, Mikel Cármenes Cavia <mi...@gmail.com>
> wrote:
>
> > Kalle,
> > I have made sure to carefully deploy the dll's to my repository, with the
> > appropriate packaging parameters and all. Initially I was using mvn
> > install:install-file, I now use mvn deploy:deploy-file, and when I look
> > inside the repository, it all seems to be there, and it looks to be
> correct.
> >
> > The problem I am having is still at the packaging stage, with the error
> > handling file set... and the PlexusIoResourceCollection not found.
> >
> > This is the same error I had before. It also says no such archiver "dll".
> > Does my pom look good to you? (I don't wanna clutter pasting it all
> again,
> > the pom and error are in the previous message).
> >
> > Thanks for your help.
> >
> > Mikel
> >
> > On Tue, Jun 17, 2008 at 15:14, Kalle Korhonen <
> kalle.o.korhonen@gmail.com>
> > wrote:
> >
> >> I'm guessing you didn't install the dll with the packaging type "dll"
> (use
> >> -Dpackaging=dll, the default is jar -
> >> http://maven.apache.org/plugins/maven-deploy-plugin/usage.html). Check
> >> your
> >> local repository and the pom for the dll. Regarding your earlier
> question,
> >> you sure can package it into a jar and JNA's supposed to extract it out
> >> from the jar automatically if not found on library path but that was
> >> exactly
> >> your original problem: either it wasn't working or java.library.path
> >> wasn't
> >> set properly. Even with JNA, it's recommended practice to have the
> library
> >> in an accessible location on the system (
> >>
> >>
> https://jna.dev.java.net/javadoc/com/sun/jna/Native.html#loadLibrary(java.lang.String,%20java.lang.Class)<https://jna.dev.java.net/javadoc/com/sun/jna/Native.html#loadLibrary%28java.lang.String,%20java.lang.Class%29>
> >> )
> >>
> >> Kalle
> >>
> >>
> >> On Tue, Jun 17, 2008 at 10:23 AM, Mikel Cármenes Cavia <
> mikelc@gmail.com>
> >> wrote:
> >>
> >> > I have followed the steps, and I am now getting the following error
> >> message
> >> > when I try to package my project:
> >> >
> >> > [INFO]
> >> >
> ------------------------------------------------------------------------
> >> > [ERROR] BUILD ERROR
> >> > [INFO]
> >> >
> ------------------------------------------------------------------------
> >> > [INFO] Failed to create assembly: Error adding file-set for
> >> > 'org.git.systems:Cur
> >> > vi:dll:1.0.0' to archive: Error adding archived file-set.
> >> > PlexusIoResourceCollec
> >> > tion not found for: C:\Documents and
> >> > Settings\Mikel\.m2\repository\org\git\syste
> >> > ms\Curvi\1.0.0\Curvi-1.0.0.dll
> >> >
> >> > No such archiver: 'dll'.
> >> > [INFO]
> >> >
> ------------------------------------------------------------------------
> >> > [INFO] For more information, run Maven with the -e switch
> >> > [INFO]
> >> >
> ------------------------------------------------------------------------
> >> > [INFO] Total time: 6 seconds
> >> > [INFO] Finished at: Tue Jun 17 14:18:20 ADT 2008
> >> > [INFO] Final Memory: 12M/25M
> >> > [INFO]
> >> >
> ------------------------------------------------------------------------
> >> >
> >> > Basically, I manually deployed the two dll's to Maven's repository
> (via
> >> mvn
> >> > install:install-file) and then made the following changes to my pom:
> >> >
> >> > ...
> >> > <dependency>
> >> > <groupId>org.git.systems</groupId>
> >> > <artifactId>Curvi</artifactId>
> >> > <version>1.0.0</version>
> >> > <scope>compile</scope>
> >> > <type>dll</type>
> >> > </dependency>
> >> > <dependency>
> >> > <groupId>org.git.systems</groupId>
> >> > <artifactId>OptimizedSolver</artifactId>
> >> > <version>1.0.0</version>
> >> > <scope>compile</scope>
> >> > <type>dll</type>
> >> > </dependency>
> >> > ...
> >> >
> >> >
> >> > ...
> >> > <plugin>
> >> > <groupId>org.apache.maven.plugins</groupId>
> >> > <artifactId>maven-dependency-plugin</artifactId>
> >> > <executions>
> >> > <execution>
> >> > <id>copy</id>
> >> > <phase>package</phase>
> >> > <goals>
> >> > <goal>copy</goal>
> >> > </goals>
> >> > <configuration>
> >> > <artifactItems>
> >> > <artifactItem>
> >> > <groupId>org.git.systems</groupId>
> >> > <artifactId>Curvi</artifactId>
> >> > <version>1.0.0</version>
> >> > <type>dll</type>
> >> > <overWrite>true</overWrite>
> >> > <outputDirectory>/testingDLL</outputDirectory>
> >> > <destFileName>Curvi</destFileName>
> >> > </artifactItem>
> >> > </artifactItems>
> >> > </configuration>
> >> > </execution>
> >> > </executions>
> >> > </plugin>
> >> >
> >> > </plugins>
> >> >
> >> > </build>
> >> > </project>
> >> >
> >> >
> >> > Is there something I did wrong along the process?
> >> >
> >> > Thanks, I can't wait to get this to work.
> >> >
> >> >
> >> > On Tue, Jun 17, 2008 at 08:12, Mikel Cármenes Cavia <mikelc@gmail.com
> >
> >> > wrote:
> >> >
> >> > > 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 <
> >> > kalle.o.korhonen@gmail.com>
> >> > > 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 <
> >> > mikelc@gmail.com>
> >> > >> 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!
> >> > >> >
> >> > >>
> >> > >
> >> > >
> >> >
> >>
> >
> >
>
Re: Incorporating DLL's into Maven Project.
Posted by Mikel Cármenes Cavia <mi...@gmail.com>.
I'm lost with this DLL business... What pains me the most is that I'm sure
it's quite the trivial thing to do, but I can't seem to figure it out...
Mikel
On Tue, Jun 17, 2008 at 15:31, Mikel Cármenes Cavia <mi...@gmail.com>
wrote:
> Kalle,
> I have made sure to carefully deploy the dll's to my repository, with the
> appropriate packaging parameters and all. Initially I was using mvn
> install:install-file, I now use mvn deploy:deploy-file, and when I look
> inside the repository, it all seems to be there, and it looks to be correct.
>
> The problem I am having is still at the packaging stage, with the error
> handling file set... and the PlexusIoResourceCollection not found.
>
> This is the same error I had before. It also says no such archiver "dll".
> Does my pom look good to you? (I don't wanna clutter pasting it all again,
> the pom and error are in the previous message).
>
> Thanks for your help.
>
> Mikel
>
> On Tue, Jun 17, 2008 at 15:14, Kalle Korhonen <ka...@gmail.com>
> wrote:
>
>> I'm guessing you didn't install the dll with the packaging type "dll" (use
>> -Dpackaging=dll, the default is jar -
>> http://maven.apache.org/plugins/maven-deploy-plugin/usage.html). Check
>> your
>> local repository and the pom for the dll. Regarding your earlier question,
>> you sure can package it into a jar and JNA's supposed to extract it out
>> from the jar automatically if not found on library path but that was
>> exactly
>> your original problem: either it wasn't working or java.library.path
>> wasn't
>> set properly. Even with JNA, it's recommended practice to have the library
>> in an accessible location on the system (
>>
>> https://jna.dev.java.net/javadoc/com/sun/jna/Native.html#loadLibrary(java.lang.String,%20java.lang.Class)
>> )
>>
>> Kalle
>>
>>
>> On Tue, Jun 17, 2008 at 10:23 AM, Mikel Cármenes Cavia <mi...@gmail.com>
>> wrote:
>>
>> > I have followed the steps, and I am now getting the following error
>> message
>> > when I try to package my project:
>> >
>> > [INFO]
>> > ------------------------------------------------------------------------
>> > [ERROR] BUILD ERROR
>> > [INFO]
>> > ------------------------------------------------------------------------
>> > [INFO] Failed to create assembly: Error adding file-set for
>> > 'org.git.systems:Cur
>> > vi:dll:1.0.0' to archive: Error adding archived file-set.
>> > PlexusIoResourceCollec
>> > tion not found for: C:\Documents and
>> > Settings\Mikel\.m2\repository\org\git\syste
>> > ms\Curvi\1.0.0\Curvi-1.0.0.dll
>> >
>> > No such archiver: 'dll'.
>> > [INFO]
>> > ------------------------------------------------------------------------
>> > [INFO] For more information, run Maven with the -e switch
>> > [INFO]
>> > ------------------------------------------------------------------------
>> > [INFO] Total time: 6 seconds
>> > [INFO] Finished at: Tue Jun 17 14:18:20 ADT 2008
>> > [INFO] Final Memory: 12M/25M
>> > [INFO]
>> > ------------------------------------------------------------------------
>> >
>> > Basically, I manually deployed the two dll's to Maven's repository (via
>> mvn
>> > install:install-file) and then made the following changes to my pom:
>> >
>> > ...
>> > <dependency>
>> > <groupId>org.git.systems</groupId>
>> > <artifactId>Curvi</artifactId>
>> > <version>1.0.0</version>
>> > <scope>compile</scope>
>> > <type>dll</type>
>> > </dependency>
>> > <dependency>
>> > <groupId>org.git.systems</groupId>
>> > <artifactId>OptimizedSolver</artifactId>
>> > <version>1.0.0</version>
>> > <scope>compile</scope>
>> > <type>dll</type>
>> > </dependency>
>> > ...
>> >
>> >
>> > ...
>> > <plugin>
>> > <groupId>org.apache.maven.plugins</groupId>
>> > <artifactId>maven-dependency-plugin</artifactId>
>> > <executions>
>> > <execution>
>> > <id>copy</id>
>> > <phase>package</phase>
>> > <goals>
>> > <goal>copy</goal>
>> > </goals>
>> > <configuration>
>> > <artifactItems>
>> > <artifactItem>
>> > <groupId>org.git.systems</groupId>
>> > <artifactId>Curvi</artifactId>
>> > <version>1.0.0</version>
>> > <type>dll</type>
>> > <overWrite>true</overWrite>
>> > <outputDirectory>/testingDLL</outputDirectory>
>> > <destFileName>Curvi</destFileName>
>> > </artifactItem>
>> > </artifactItems>
>> > </configuration>
>> > </execution>
>> > </executions>
>> > </plugin>
>> >
>> > </plugins>
>> >
>> > </build>
>> > </project>
>> >
>> >
>> > Is there something I did wrong along the process?
>> >
>> > Thanks, I can't wait to get this to work.
>> >
>> >
>> > On Tue, Jun 17, 2008 at 08:12, Mikel Cármenes Cavia <mi...@gmail.com>
>> > wrote:
>> >
>> > > 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 <
>> > kalle.o.korhonen@gmail.com>
>> > > 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 <
>> > mikelc@gmail.com>
>> > >> 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!
>> > >> >
>> > >>
>> > >
>> > >
>> >
>>
>
>
Re: Incorporating DLL's into Maven Project.
Posted by Mikel Cármenes Cavia <mi...@gmail.com>.
Kalle,
I have made sure to carefully deploy the dll's to my repository, with the
appropriate packaging parameters and all. Initially I was using mvn
install:install-file, I now use mvn deploy:deploy-file, and when I look
inside the repository, it all seems to be there, and it looks to be correct.
The problem I am having is still at the packaging stage, with the error
handling file set... and the PlexusIoResourceCollection not found.
This is the same error I had before. It also says no such archiver "dll".
Does my pom look good to you? (I don't wanna clutter pasting it all again,
the pom and error are in the previous message).
Thanks for your help.
Mikel
On Tue, Jun 17, 2008 at 15:14, Kalle Korhonen <ka...@gmail.com>
wrote:
> I'm guessing you didn't install the dll with the packaging type "dll" (use
> -Dpackaging=dll, the default is jar -
> http://maven.apache.org/plugins/maven-deploy-plugin/usage.html). Check
> your
> local repository and the pom for the dll. Regarding your earlier question,
> you sure can package it into a jar and JNA's supposed to extract it out
> from the jar automatically if not found on library path but that was
> exactly
> your original problem: either it wasn't working or java.library.path wasn't
> set properly. Even with JNA, it's recommended practice to have the library
> in an accessible location on the system (
>
> https://jna.dev.java.net/javadoc/com/sun/jna/Native.html#loadLibrary(java.lang.String,%20java.lang.Class)
> )
>
> Kalle
>
>
> On Tue, Jun 17, 2008 at 10:23 AM, Mikel Cármenes Cavia <mi...@gmail.com>
> wrote:
>
> > I have followed the steps, and I am now getting the following error
> message
> > when I try to package my project:
> >
> > [INFO]
> > ------------------------------------------------------------------------
> > [ERROR] BUILD ERROR
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] Failed to create assembly: Error adding file-set for
> > 'org.git.systems:Cur
> > vi:dll:1.0.0' to archive: Error adding archived file-set.
> > PlexusIoResourceCollec
> > tion not found for: C:\Documents and
> > Settings\Mikel\.m2\repository\org\git\syste
> > ms\Curvi\1.0.0\Curvi-1.0.0.dll
> >
> > No such archiver: 'dll'.
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] For more information, run Maven with the -e switch
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] Total time: 6 seconds
> > [INFO] Finished at: Tue Jun 17 14:18:20 ADT 2008
> > [INFO] Final Memory: 12M/25M
> > [INFO]
> > ------------------------------------------------------------------------
> >
> > Basically, I manually deployed the two dll's to Maven's repository (via
> mvn
> > install:install-file) and then made the following changes to my pom:
> >
> > ...
> > <dependency>
> > <groupId>org.git.systems</groupId>
> > <artifactId>Curvi</artifactId>
> > <version>1.0.0</version>
> > <scope>compile</scope>
> > <type>dll</type>
> > </dependency>
> > <dependency>
> > <groupId>org.git.systems</groupId>
> > <artifactId>OptimizedSolver</artifactId>
> > <version>1.0.0</version>
> > <scope>compile</scope>
> > <type>dll</type>
> > </dependency>
> > ...
> >
> >
> > ...
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-dependency-plugin</artifactId>
> > <executions>
> > <execution>
> > <id>copy</id>
> > <phase>package</phase>
> > <goals>
> > <goal>copy</goal>
> > </goals>
> > <configuration>
> > <artifactItems>
> > <artifactItem>
> > <groupId>org.git.systems</groupId>
> > <artifactId>Curvi</artifactId>
> > <version>1.0.0</version>
> > <type>dll</type>
> > <overWrite>true</overWrite>
> > <outputDirectory>/testingDLL</outputDirectory>
> > <destFileName>Curvi</destFileName>
> > </artifactItem>
> > </artifactItems>
> > </configuration>
> > </execution>
> > </executions>
> > </plugin>
> >
> > </plugins>
> >
> > </build>
> > </project>
> >
> >
> > Is there something I did wrong along the process?
> >
> > Thanks, I can't wait to get this to work.
> >
> >
> > On Tue, Jun 17, 2008 at 08:12, Mikel Cármenes Cavia <mi...@gmail.com>
> > wrote:
> >
> > > 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 <
> > kalle.o.korhonen@gmail.com>
> > > 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 <
> > mikelc@gmail.com>
> > >> 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!
> > >> >
> > >>
> > >
> > >
> >
>
Re: Incorporating DLL's into Maven Project.
Posted by Kalle Korhonen <ka...@gmail.com>.
I'm guessing you didn't install the dll with the packaging type "dll" (use
-Dpackaging=dll, the default is jar -
http://maven.apache.org/plugins/maven-deploy-plugin/usage.html). Check your
local repository and the pom for the dll. Regarding your earlier question,
you sure can package it into a jar and JNA's supposed to extract it out
from the jar automatically if not found on library path but that was exactly
your original problem: either it wasn't working or java.library.path wasn't
set properly. Even with JNA, it's recommended practice to have the library
in an accessible location on the system (
https://jna.dev.java.net/javadoc/com/sun/jna/Native.html#loadLibrary(java.lang.String,%20java.lang.Class))
Kalle
On Tue, Jun 17, 2008 at 10:23 AM, Mikel Cármenes Cavia <mi...@gmail.com>
wrote:
> I have followed the steps, and I am now getting the following error message
> when I try to package my project:
>
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] BUILD ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Failed to create assembly: Error adding file-set for
> 'org.git.systems:Cur
> vi:dll:1.0.0' to archive: Error adding archived file-set.
> PlexusIoResourceCollec
> tion not found for: C:\Documents and
> Settings\Mikel\.m2\repository\org\git\syste
> ms\Curvi\1.0.0\Curvi-1.0.0.dll
>
> No such archiver: 'dll'.
> [INFO]
> ------------------------------------------------------------------------
> [INFO] For more information, run Maven with the -e switch
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 6 seconds
> [INFO] Finished at: Tue Jun 17 14:18:20 ADT 2008
> [INFO] Final Memory: 12M/25M
> [INFO]
> ------------------------------------------------------------------------
>
> Basically, I manually deployed the two dll's to Maven's repository (via mvn
> install:install-file) and then made the following changes to my pom:
>
> ...
> <dependency>
> <groupId>org.git.systems</groupId>
> <artifactId>Curvi</artifactId>
> <version>1.0.0</version>
> <scope>compile</scope>
> <type>dll</type>
> </dependency>
> <dependency>
> <groupId>org.git.systems</groupId>
> <artifactId>OptimizedSolver</artifactId>
> <version>1.0.0</version>
> <scope>compile</scope>
> <type>dll</type>
> </dependency>
> ...
>
>
> ...
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-dependency-plugin</artifactId>
> <executions>
> <execution>
> <id>copy</id>
> <phase>package</phase>
> <goals>
> <goal>copy</goal>
> </goals>
> <configuration>
> <artifactItems>
> <artifactItem>
> <groupId>org.git.systems</groupId>
> <artifactId>Curvi</artifactId>
> <version>1.0.0</version>
> <type>dll</type>
> <overWrite>true</overWrite>
> <outputDirectory>/testingDLL</outputDirectory>
> <destFileName>Curvi</destFileName>
> </artifactItem>
> </artifactItems>
> </configuration>
> </execution>
> </executions>
> </plugin>
>
> </plugins>
>
> </build>
> </project>
>
>
> Is there something I did wrong along the process?
>
> Thanks, I can't wait to get this to work.
>
>
> On Tue, Jun 17, 2008 at 08:12, Mikel Cármenes Cavia <mi...@gmail.com>
> wrote:
>
> > 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 <
> kalle.o.korhonen@gmail.com>
> > 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 <
> mikelc@gmail.com>
> >> 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!
> >> >
> >>
> >
> >
>
Re: Incorporating DLL's into Maven Project.
Posted by Mikel Cármenes Cavia <mi...@gmail.com>.
I have followed the steps, and I am now getting the following error message
when I try to package my project:
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
------------------------------------------------------------------------
[INFO] Failed to create assembly: Error adding file-set for
'org.git.systems:Cur
vi:dll:1.0.0' to archive: Error adding archived file-set.
PlexusIoResourceCollec
tion not found for: C:\Documents and
Settings\Mikel\.m2\repository\org\git\syste
ms\Curvi\1.0.0\Curvi-1.0.0.dll
No such archiver: 'dll'.
[INFO]
------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 6 seconds
[INFO] Finished at: Tue Jun 17 14:18:20 ADT 2008
[INFO] Final Memory: 12M/25M
[INFO]
------------------------------------------------------------------------
Basically, I manually deployed the two dll's to Maven's repository (via mvn
install:install-file) and then made the following changes to my pom:
...
<dependency>
<groupId>org.git.systems</groupId>
<artifactId>Curvi</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
<type>dll</type>
</dependency>
<dependency>
<groupId>org.git.systems</groupId>
<artifactId>OptimizedSolver</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
<type>dll</type>
</dependency>
...
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.git.systems</groupId>
<artifactId>Curvi</artifactId>
<version>1.0.0</version>
<type>dll</type>
<overWrite>true</overWrite>
<outputDirectory>/testingDLL</outputDirectory>
<destFileName>Curvi</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Is there something I did wrong along the process?
Thanks, I can't wait to get this to work.
On Tue, Jun 17, 2008 at 08:12, Mikel Cármenes Cavia <mi...@gmail.com>
wrote:
> 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 <ka...@gmail.com>
> 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 <mi...@gmail.com>
>> 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!
>> >
>>
>
>
Re: Incorporating DLL's into Maven Project.
Posted by Mikel Cármenes Cavia <mi...@gmail.com>.
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 <ka...@gmail.com>
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 <mi...@gmail.com>
> 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!
> >
>
Re: Incorporating DLL's into Maven Project.
Posted by Kalle Korhonen <ka...@gmail.com>.
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 <mi...@gmail.com>
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!
>