I am currently working on a project that includes using JNotify to monitor when a directory/file has been created, renamed/modified, and deleted. The project is being built in Java 6, not Java 7. JNotify uses JNI to hook into the native OS to monitor the directory/file. My problem is that I need to get JNotify into our repo but I want it to be built so that the java.library.path (DLL) is packaged with the JNI JAR. How would I go about doing that in Maven?
Asked
Active
Viewed 2,469 times
3 Answers
2
I was able to find the solution I needed using the following maven plugin: http://code.google.com/p/mavennatives/

Edward Kennedy
- 137
- 1
- 9
0
You must probably upload the jar manually to your archiva instance.

Olivier Lamy
- 2,280
- 1
- 14
- 12
-
2That's a no brainer, the problem is that just having the JAR doesn't help. You need to have the jnotify.dll and/or jnotify_64bit.dll in the java.library.path. The question is, "How can we store the JAR and DLLs in a repo so that it can easily be brought into a project for use?" – Edward Kennedy Apr 17 '12 at 13:13
0
The repository format is fixed, so you will need to perform the rename after retrieving the artifact. That depends how you intend to use it after it is retrieved.
This is a common pattern is something like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<configuration>
<stripVersion>true</stripVersion>
</configuration>
<executions>
<execution>
<id>copy-jnotify</id>
<configuration>
<includeArtifactIds>JNotify</includeArtifactIds>
<outputDirectory>${project.build.directory}/my-app</outputDirectory>
</configuration>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>
You can use this with the appropriate list of artifacts that will all be copied into the target/my-app
directory

Brett Porter
- 5,827
- 27
- 25