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

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

问题描述

过去几天我一直在空闲时间学习 Maven,但似乎无法弄清楚如何组织项目以便使用 JOGL 库.我更喜欢以下内容:

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. 如有必要,从 此处(包含4个jar文件和一些本机库文件(.so/.dll));或依赖一个 Maven 项目,它是其中一个文件的包装器.
  2. 适当地解压缩该 zip 文件,以便:
  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. 将 jar 文件添加到类路径并根据需要进行部署,以及
  2. 本地库文件被添加到最终的 jar 文件中(这是否能让它们自动使用,或者我需要更多的东西?)

我认为我的部分问题是我没有完全理解JOGL的使用,运行代码时将本地库放在哪里等.我需要回到基础并编写一个JOGL hello world,从命令行编译它并从命令行运行它,以确切了解它需要什么,就本机库的目录放置而言;实际上,我现在就可以去做.

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.

在第 1 项中,我发现了一些特定于操作系统的功能;Maven 配置文件可以根据系统的属性激活,包括操作系统.然后我可以激活一个 Windows 配置文件,它依赖于特定于 Windows 的 JOGL 库,对于 Linux 也是如此,并且两者都有一个 64 位的另一个自我.(激活官方文档/非官方文档.)

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.)

我已经尝试过基于一个JOGL jar文件创建一个Maven存储库,然后将JOGL jar文件项目添加为我的项目的依赖项;依赖项已下载,但未使用.我不知道 jar 文件在哪里,也不知道如何使用它、如何解包等等.这是我使用的命令.

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.

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

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 现在包含对 Maven 和 jogl 组件的支持(即将提供 jocl 和 joal 支持).从 2.0-rc11 开始,包被推送到 Maven Central.

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.

把这个放到你的 pom 上:

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 将在您下次尝试构建项目时提取所有依赖项.

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

在 wiki 上阅读更多内容

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

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