Hello

Could somebody help me with the following problem:

I have a project that uses some native libraries (dll's). I would like to create 2 JAR artifacts out of this project
- one with the Java classes of the project and
- another with nothing else but the native libraries.

What is the appropriate way to achieve this?

I tried to play with the maven-jar-plugin configuration and did the following:
1.
I defined an execution for the maven-jar-plugin that includes the native libraries:
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.2</version>
            <executions>
                <execution>
                    <id>native</id>
                    <phase>package</phase>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                    <configuration>
                        <classifier>nativelibs</classifier>
                        <includes>
                            <include>${basedir}/native/*.dll</include>
                        </includes>
                    </configuration>
                </execution>
            </executions>
        </plugin>
The result is that the created <app>-nativelibs.jar does not have the DLL's.

2.
Then I tried to specify that the native libraries are resources to be copied under target/classes:

<build>
  <resources>
    <resource>
      <directory>${basedir}/native</directory>
      <includes>
        <include>**/*</include>
      </includes>
    </resource>
  </resources>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-jar-plugin</artifactId>
      <version>2.2</version>
      <executions>
        <execution>
          <id>native</id>
          <phase>package</phase>
          <goals>
            <goal>jar</goal>
          </goals>
          <configuration>
            <classifier>nativelibs</classifier>
            <includes>
              <include>**/*.dll</include>
            </includes>
          </configuration>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

This time the native libraries are in the <app>-nativelibs.jar but the problem is that they are also packaged into the default artifact (<app>.jar)

3.
If I exclude the native libraries from the default execution then I cannot include them anymore in another execution.

Thanks for any help.
Richie

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to