Maven和JOGL库? [英] Maven and the JOGL library?

查看:146
本文介绍了Maven和JOGL库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在过去几天的空闲时间里一直在研究Maven,但似乎无法弄清楚如何组织项目以便使用JOGL库。我最好喜欢以下内容:


  1. 如有必要,从这里(包含4个jar文件和一些本机库文件(.so / .dll));或依赖于Maven项目,该项目是其中一个文件的包装。

  2. 适当地解压缩该zip文件,以便:


    1. 将jar文件添加到类路径并根据需要进行部署,并且

    2. 将本机库文件添加到最终的jar文件中(这样可以自动使用它们,或者我需要更多的参与?)


我认为我的问题的一部分是我不完全理解JOGL的使用,在运行代码时放置本机库的位置等等。我需要回到基础知识并编写JOGL hello世界,从命令行编译并运行它从命令行中查看本地库的目录放置所需的确切内容;我现在可能会这样做,实际上。



对于第1项,我发现了一些特定于操作系统的功能;可以基于系统的属性(包括操作系统)激活Maven配置文件。那么我就可以激活一个Windows配置文件,它具有Windows特定的JOGL库的依赖性,对于Linux也是如此,并且都具有64位的改变自我。 (激活官方文档 / 非官方文档。)



<我尝试创建一个基于JOGL jar文件的Maven存储库,然后添加JOGL jar文件项目作为我项目的依赖项;依赖项已下载,但未使用。我不知道jar文件在哪里或如何使用它,打开包装等。这是我使用的命令。



因此,简而言之: JOGL由四个.jar文件和一些本机库组成。如何将这些文件集成到我的Maven项目中,以便我可以使用Maven编写JOGL应用程序来处理我的构建过程?此外,我如何根据操作系统使用不同的文件集,因为当然本机库甚至.jar文件在Windows,Linux和Mac之间都有所不同。

解决方案

Jogamp现在包含对Maven的支持, jogl组件(jocl和joal支持即将发布)。从2.0-rc11开始,软件包被推送到Maven Central。



把它放到你的pom:

 < 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>
< / dependencies>

Maven将在您下次尝试构建项目时提取所有依赖项。



在维基上阅读更多内容


I've been studying Maven in my free time over the last several days but can't seem to figure out how to organize a project so that the JOGL libraries are used. I would preferably like the following:

  1. Automatically download, if necessary, the OS-specific JOGL zip file from here (contains 4 jar files and some native library files (.so/.dll)); or depend on a Maven project which is a wrapper of one of the files.
  2. Unzip that zip file appropriately, so that:

    1. the jar files are added to the classpath and deployed as necessary, and
    2. the native library files are added to the final jar file (would this enable them to be automatically used, or would I need something more involved?)

I think part of my problem is that I don't fully understand the use of JOGL, where to place the native libraries when running the code, etc. I need to go back to the basics and write a JOGL hello world, compile it from the command line and run it from the command line to see exactly what it requires as far as directory placement of the native libraries; I may go do that right now, actually.

With item 1, I've found some OS-specific features; Maven profiles can be activated based on properties of the system, which include the operating system. So then I could activate a Windows profile which has a dependency of the Windows-specific JOGL library, same for the Linux, and both having a 64-bit alter ego. (Activation official docs / unofficial docs.)

I have tried creating a Maven repository based on a JOGL jar file, and then adding the JOGL jar file project as a dependency of my project; the dependency is downloaded, but not used. I have no idea where the jar file goes or how to use it, unpack it, etc. Here is the command I used.

So, in short: JOGL consists of four .jar files and some native libraries. How can I integrate those files into my Maven project so that I can write a JOGL application with Maven handling my build process? Furthermore, how can I use a different set of files depending on the operating system, because of course the native libraries and even the .jar files differ between Windows, Linux and Mac.

解决方案

Jogamp now contains support for Maven, for the jogl components (jocl and joal support is forthcoming). As of 2.0-rc11, packages are pushed to Maven Central.

Just put this to your pom:

 <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>
 </dependencies>

Maven will pull all of the dependencies the next time you attempt to build the project.

Read more here on the wiki

这篇关于Maven和JOGL库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆