My project depends on a 3rd party library for OpenGL + Java called JOGL
(http://jogamp.org/jogl/www/)

The library is currently not maven-ized and I'm trying to find the best
way to achieve that.  My progress is documented at:
http://jogamp.762907.n3.nabble.com/maven2-artifacts-tp1935908p1935908.html

To get started I'm just manually putting the JOGL jars into a local
repository.  Currently this is 4 jar files and each jar has a dependency
on a couple of native libs (.dll .jnilib .so etc) which I'm zipping and
then unpacking again for my project with:

   <!-- Unpack native libs -->
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-dependencies</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                           
<outputDirectory>${basedir}/lib</outputDirectory>
                            <includeTypes>zip</includeTypes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>


For each Jar I have a block like this:

        <dependency>
            <groupId>com.jogamp.jogl</groupId>
            <artifactId>jogl-all</artifactId>
            <version>${jogl.version}</version>
        </dependency>
        <dependency>
            <groupId>com.jogamp.jogl</groupId>
            <artifactId>jogl-natives</artifactId>
            <version>${jogl.version}</version>
            <classifier>osx-universal</classifier>
            <type>zip</type>
        </dependency>

Now this is going to get ugly quite fast, ie once I add all 5 supported
native platforms.  It also feels wrong, although I'm very new to
maven2.  Somehow I expected that there would be a way to tie the native
dependencies together with the jar in a more elegant way, maybe
something like:

        <dependency>
            <groupId>com.jogamp.jogl</groupId>
            <artifactId>jogl-all</artifactId>
            <version>${jogl.version}</version>
            <classifier>sources</classifier>
            <classifier>javadoc</classifier>
            <classifier>osx-universal</classifier>
            <classifier>windows</classifier>
            <classifier>linux</classifier>
                        ...
        </dependency>

I considered some kind of wrapper pom for each jar, but it also feels
like a work-around.  ie the jar can't be used without the natives, so
somehow they should be configured as a single artifact/entity/dependency.

The next issue I trip over with native handling, is eclipse:eclipse. 
Looking at the sources, it seems to take account of classifiers for
'sources' and 'javadoc' but I don't see anything for handling of native
directories.  ie the EclipseClasspathWriter and AbstractIdeSupportMojo
would need to output something like this:

    <classpathentry kind="var"
path="M2_REPO/com/jogamp/jogl/jogl-all/2.0.251/jogl-all-2.0.251.jar">
        <attributes>
            <attribute
name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY"
value="client/lib"/>
        </attributes>
    </classpathentry>


Now I'm thinking I can't be the first person to trip over this, but
google isn't giving much help.  So I'm wondering how other people are
dealing with this?

Or is it just that maven currently just isn't designed to work with
native dependencies?




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to