Edward Kennedy
Edward Kennedy

Reputation: 137

Getting JNotify into Maven/Archiva

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?

Upvotes: 3

Views: 2506

Answers (3)

Edward Kennedy
Edward Kennedy

Reputation: 137

I was able to find the solution I needed using the following maven plugin: http://code.google.com/p/mavennatives/

Upvotes: 2

Brett Porter
Brett Porter

Reputation: 5867

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

Upvotes: 0

Olivier Lamy
Olivier Lamy

Reputation: 2310

You must probably upload the jar manually to your archiva instance.

Upvotes: 0

Related Questions