문제

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?

도움이 되었습니까?

해결책

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

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top