Maven support?

386 views
Skip to first unread message

Jeremy McCormick

unread,
Mar 12, 2013, 8:18:12 PM3/12/13
to jz...@googlegroups.com
Hi,

Is there any level of Maven support for jzy3d?

In the project within which I would like to add it as a dependency, all the other jars are available in public Maven repositories or we deploy them ourselves, but I don't find jzy3d in any public repositories..

I found a previous thread which seems to indicate that others have tried to get this working but did not succeed, specifically this one:

https://groups.google.com/forum/?fromgroups#!topic/jzy3d/PJN9f_T4_Hc

I am okay with having to add, for instance, a setting for java.library.path when the application is launched.  All non-native dependencies would need to be bundled into a single jar.

Is this going to be possible?  How should I get started?  Should I deploy jzy3d into our repository since it isn't externally available?  etc.

In general, is there some reason at least the non-native dependencies aren't packaged using Maven? 

Of course, I'm asking about all this because this library seems quite impressive, and I would like to use it as a backend for plotting 3D scatter data, lego plots to display 2D histograms, etc.  And I haven't really found anything else comparable in Java.

Thanks for any advice you can give on this topic.

--Jeremy

Jeremy McCormick

unread,
Mar 12, 2013, 10:34:05 PM3/12/13
to jz...@googlegroups.com
Well, in the spirit of contribution, I wrote out a nice little POM file for my copy of JZY3D. 

See below:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>jzy3d</groupId>
    <artifactId>jzy3d</artifactId>
    <version>0.9-SNAPSHOT</version>
    <name>jzy3d</name>
    <description>A Java API for 3d charts</description>
    <repositories>
        <repository>
            <id>swt-repo</id>
            <url>https://swt-repo.googlecode.com/svn/repo/</url>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>org.jogamp.gluegen</groupId>
            <artifactId>gluegen-rt-main</artifactId>
            <version>2.0-rc11</version>
        </dependency>
        <dependency>
            <groupId>org.jogamp.jogl</groupId>
            <artifactId>jogl-all-main</artifactId>
            <version>2.0-rc11</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.16</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.swt</groupId>
            <artifactId>org.eclipse.swt.gtk.linux.x86_64</artifactId>
            <version>4.2.1</version>
        </dependency>
        <dependency>
            <groupId>net.sf.opencsv</groupId>
            <artifactId>opencsv</artifactId>
            <version>2.1</version>
        </dependency>
        <!--
        The next dep was installed locally by adding a POM to its project and executing 'mvn install'.
        -->
        <dependency>
            <groupId>convexhull</groupId>
            <artifactId>convexhull</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
        <!--
        The next dep is contained in the jzy3d project and was installed locally:

        mvn install:install-file \
        -DgroupId=org.jzyio \
        -DartifactId=jzyio \
        -Dversion=0.1 \
        -Dpackaging=jar \
        -Dfile=./lib/misc/org.jzyio-0.1.jar
        -->
        <dependency>
            <groupId>org.jzyio</groupId>
            <artifactId>jzyio</artifactId>
            <version>0.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <testSourceDirectory>src/tests</testSourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>src/api</source>
                                <source>src/bridge</source>
                                <source>src/glredbook</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <!-- TODO: Change to 1.7 -->
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>org/jzy3d/junit/ChartTest.java</exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

I was kind of surprised this works actually amazingly well, but there's a couple issues you have to solve locally.

Firstly, the convexhull code is not available on any Maven repository.  So, I just downloaded it and dropped the following POM into its root directory:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>convexhull</groupId>
  <artifactId>convexhull</artifactId>
  <version>1.0-SNAPSHOT</version>
  <name>convexhull</name>
  <repositories>
  </repositories>
  <dependencies>
  </dependencies>
  <build>
    <plugins>
      <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>build-helper-maven-plugin</artifactId>
      <executions>
        <execution>
          <phase>generate-sources</phase>
          <goals><goal>add-source</goal></goals>
          <configuration>
            <sources>
              <source>convexhull/src/convexhull</source>
              <source>convexhull/src/io</source>
              <source>convexhull/src/utils</source>
              <source>convexhull/src/algorithms</source>
            </sources>
          </configuration>
        </execution>
      </executions>
    </plugin>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>3.0</version>
      <configuration>
        <source>1.6</source>
        <target>1.6</target>
      </configuration>
    </plugin>
    </plugins>
  </build>
</project>

Then run 'mvn clean install' and it is available locally as 1.0-SNAPSHOT in your repo.

Okay, let's see, so that left only one minor problem, which is that the jzyio library is also not available, um, anywhere.  I couldn't even find the source code.

So I installed it locally from lib/misc using this command:

mvn install:install-file \
        -DgroupId=org.jzyio \
        -DartifactId=jzyio \
        -Dversion=0.1 \
        -Dpackaging=jar \
        -Dfile=./lib/misc/org.jzyio-0.1.jar

Then I was able to run 'mvn clean install -DskipTests=true' on my jzy3d with the new POM and I get it in my local repository.

Finally, I can then depend on the newly installed jzy3d jar with this XML in some other project:

<dependency>
    <groupId>jzy3d</groupId>
    <artifactId>jzy3d</artifactId>
    <version>0.9-SNAPSHOT</version>
</dependency>

Developing in Eclipse, I was then able to create a test file based off one of the examples, and right click > Run As > Java Application, and it actually works!

Alright, well my work here is done for now.  I'd love it if the JZY3D maintainer could pull this POM file into the project.

One would just need to solve the above issues in order to deploy it to a repository.  My suggested solutions would be pulling the convexhull code into the jzy3d source tree (if the license allows) or it could be deployed using the POM I listed. 

And I also suggest something similar for jzyio, which is a very small set of code.  Why not fold it into the jzy3d code base?

Cheers.

--Jeremy

Nils Hoffmann

unread,
Mar 13, 2013, 4:04:19 AM3/13/13
to jz...@googlegroups.com
Hi Jeremy,
this looks good to me for a start. I would personally think, that a multi-module aggregator project type would be most
suitable since this would also allow us to split the glredbook and other additional source packages that one might not need in to seperate modules and in the end, separate artifacts. My proposal would be something like:

jzy3d (parent directory with parent pom)
|-jzy3d-api    (api implementation, currently under src/api)
|-jzy3d-bridge (bridge impl, currently under src/bridge)
|-jzy3d-convexhull
|-jzy3d-io (or jzyio)
|-jzy3d-glredbook (glredbook samples, currently under src/glredbook)

I think that this is a good point for discussion. According to
http://maven.apache.org/guides/mini/guide-central-repository-upload.html
it should not be too hard to get deploy access to the maven central repository.

Cheers,
Nils
--
Vous recevez ce message, car vous êtes abonné au groupe Google Groupes Jzy3d.
Pour vous désabonner de ce groupe et ne plus recevoir d'e-mails le concernant, envoyez un e-mail à l'adresse jzy3d+un...@googlegroups.com.
Pour plus d'options, visitez le site https://groups.google.com/groups/opt_out .
 
 

Martin Pernollet

unread,
Mar 13, 2013, 4:27:19 AM3/13/13
to Jzy3d
Hi Jeremy,

Thanks for sharing the maven scripts and reminding the dirty dependency management in Jzy3d :) I added an entry in the issue list [1] with a todo list that can be discussed.

Jzy3d lacked maven support up to now mainly because Jogl and other dependencies were also lacking maven support. As Jogl is now available on maven, we might clone and mavenify other dependencies (e.g. convexhull).

@Nils: I agree glredbook should not be part of the API build. I think it should even be better to move it in a separate project here [2]. I would however keep the bridge in the API as the component factory use part of it (mainly IFrame and implementation... and soon your work on Newt-Awt bridge :) ). But I'm open to discussions on these points. 

Martin



2013/3/13 Nils Hoffmann <nils.h...@web.de>

Jeremy McCormick

unread,
Mar 14, 2013, 7:09:20 PM3/14/13
to jz...@googlegroups.com
Hi and thanks for the interest in this.  I like to do all my dependency management with Maven these days.

So I think the sub-issues to solve for creating the POM for JZY3D would be something like the following:

1) The convexhull dependency should be deployed to a public Maven repository so that it can be referenced properly.  If needed, this might require some interaction with its developer to get their approval.  I think it would be fine to deploy as a 1.0 release and leave it at that as I don't think the code has changed recently.  This can be done by creating a proper POM for it with deployment information or just using a manual deployment command from the command line.  (which I can provide if necessary)

2) The jzyio dependency needs to be resolved also.  I couldn't even find where these sources live, actually.  I would suggest just rolling this code into the JZY3D project, as it seems pretty minimal, i.e. just one class that is used in the tests as far as I can tell.  Or it could be deployed as a proper Maven project if it needs to be kept separate.  The simple solution is just to put the code into the project's sources.

3) The SWT dependency I have listed in the proposed model is for Linux only.  These jars are all platform specific.  I don't know if there is one umbrella project that could be referenced to pull these all in but listing all available platforms in the JZY3D POM is probably not desirable.  Alternately, one could list only the SWT API project and require projects using JZY3D to pull in whatever platform versions of SWT are needed.  (I think this would work...?)

4) The glredbook code could probably be put into a separate project entirely which depends on jzy3d.  I think the "api" and "bridge" sources are really what most people are going to want to reference in their projects that use JZY3D.

5) At least one of the batch mode tests fail as there is some different in pixel output, but I can't spot it by eye.  It actually looks fine to me.  This should be resolved.

6) This one is trivial.  I listed the version as 0.9-SNAPSHOT but since 0.9 is released, this should be changed to 0.9.1 or 1.0 or whatever you want as the next version to avoid confusion.

I think that's about it.  For now, I'm setup locally, and I'm able to launch JZY3D plots right out of Eclipse.  But it would be good to standardize this so that others can simply reference the project from their POM and have it "just work."  You'll probably see a lot more people using this (quite excellent, BTW) package if it is really easy for them to pull it in using Maven dependencies.

Thanks.

--Jeremy

Martin Pernollet

unread,
Mar 15, 2013, 8:04:18 AM3/15/13
to Jzy3d
Hi,

Thank you for suggestions. 
I did some cleanup and created new repositories (see my comment to your points). I've made the dependencies more explicit in readme.md at jzy3d-api repository root.
I personnaly prefer Ivy, but I'm fine using Maven as it is widely used, and you already did most of the work :).
If you intend to adapt your maven files to use the repository changes, why not sharing them through a pull request that I might merge? If you want to do so, please do not remove the existing build.xml file that are still usefull.
Do not hesitate to ask questions if something is not working as expected after the repo cleanup.

One thing will change later: linking to jdt-core latest version. For the moment the Jdt sources are copied in Jzy3d. I recently sent a bug to the lib author. I will cleanup and externalize dependency once a JDT fix is available.
 

So I think the sub-issues to solve for creating the POM for JZY3D would be something like the following:

1) The convexhull dependency should be deployed to a public Maven repository so that it can be referenced properly.  If needed, this might require some interaction with its developer to get their approval.  I think it would be fine to deploy as a 1.0 release and leave it at that as I don't think the code has changed recently.  This can be done by creating a proper POM for it with deployment information or just using a manual deployment command from the command line.  (which I can provide if necessary)

I have cloned the google repository and added jzy3d-tools-convexhull. It indeed did not changed since 2008, but with a clone we can add maven pom files easily. I contacted the authors when I started using the library but had no answers, so I believe a reference to their original work is the best thing to do.

You might also see jzy3d-tools-libsvm, a clone of the so called support vector machine library for java. It is not required by jzy3d, but required for jzy3d-svm-mapper, an example of a Mapper based on a regression model.
 

2) The jzyio dependency needs to be resolved also.  I couldn't even find where these sources live, actually.  I would suggest just rolling this code into the JZY3D project, as it seems pretty minimal, i.e. just one class that is used in the tests as far as I can tell.  Or it could be deployed as a proper Maven project if it needs to be kept separate.  The simple solution is just to put the code into the project's sources.

I'm stupid enough to have loose the original project, but I uncompiled the jar and moved java files in org.jzy3d.io
 

3) The SWT dependency I have listed in the proposed model is for Linux only.  These jars are all platform specific.  I don't know if there is one umbrella project that could be referenced to pull these all in but listing all available platforms in the JZY3D POM is probably not desirable.  Alternately, one could list only the SWT API project and require projects using JZY3D to pull in whatever platform versions of SWT are needed.  (I think this would work...?)

Strange, I used it on window without problem.
I think it is nice to have a self contained repository holding all available swt impl (if possible), so that you don't have to understand what lib is missing when starting a project. I believe the cost of having extra libs is not that height. But maybe that might "poluate" user projects with undesired library? What do you think? 
 

4) The glredbook code could probably be put into a separate project entirely which depends on jzy3d.  I think the "api" and "bridge" sources are really what most people are going to want to reference in their projects that use JZY3D.


Glredbook moved to another repository, and depending on jzy3d project through eclipse.

 

5) At least one of the batch mode tests fail as there is some different in pixel output, but I can't spot it by eye.  It actually looks fine to me.  This should be resolved.

Yes, I have a computer for which Locale is different from the one used while generating test case assertion images, and thus "," and "." conflict. Also, Colorbar is using default system font which might also differs from user to user. 
We should have both settings enforced, at least in a test context.

 

6) This one is trivial.  I listed the version as 0.9-SNAPSHOT but since 0.9 is released, this should be changed to 0.9.1 or 1.0 or whatever you want as the next version to avoid confusion.

0.9.1 is fine, there are already a couple of new things since 0.9, but some of them still in experimental state. I would wait they're stable to move to 1.0.

Let me know if you have time to contribute your maven work.
Cheers,
Martin

Jeremy McCormick

unread,
Mar 17, 2013, 6:09:57 PM3/17/13
to jz...@googlegroups.com
Hi,

I cloned your repository here and added a POM file.

https://github.com/JeremyMcCormick/jzy3d-api.git

Are you able to get this?

The POM for the convexhull project is not in any source repository but you have my permission to use the one I posted above if needed.

--Jeremy

Jeremy McCormick

unread,
Mar 17, 2013, 6:23:55 PM3/17/13
to jz...@googlegroups.com
Hi,

More info...

The (preliminary) POM I included in above post is here:

https://github.com/JeremyMcCormick/jzy3d-api/blob/master/pom.xml

You have my permission to pull into into your project.  My fork is behind now, so you probably just want to grab the one file.

It still needs some work but it is a good start.


--Jeremy

On Friday, March 15, 2013 5:04:18 AM UTC-7, Martin wrote:
Reply all
Reply to author
Forward
0 new messages