Question

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?

Était-ce utile?

La solution

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

Autres conseils

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

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top