简体   繁体   English

由于依赖性,无法将World Wind Java用于maven项目

[英]Can't use World Wind Java into a maven project because of dependencies

I a am trying to use World Wind Java into a Maven project. 我正在尝试将World Wind Java用于Maven项目。

First method would be to take their SDK here and all dependencies in build path. 第一种方法是在这里获取他们的SDK以及构建路径中的所有依赖项。 But I want to make it more maven compliant. 但我想让它更符合maven。

First dependency : jogl-all.jar. 第一个依赖:jogl-all.jar。 SDK v2.0.0 seems to use v2.1.5 of JOGL (from manifest). SDK v2.0.0似乎使用JOGL的v2.1.5(来自清单)。 Hence I put this in my pom file: 因此我把它放在我的pom文件中:

<dependency>
    <groupId>org.jogamp.jogl</groupId>
    <artifactId>jogl-all</artifactId>
    <version>2.1.5</version>
</dependency>

Here is my issue : two jar files are very different in size, and moreover, with JOGL jar from SDK, I can import com.jogamp.opengl.awt.GLCanvas , while with maven retrieved JAR, I can't. 这是我的问题: 两个jar文件的大小差异很大,而且,使用来自SDK的JOGL jar,我可以导入com.jogamp.opengl.awt.GLCanvas ,而使用maven检索JAR,我不能。

I don't understand how I can get two different behaviors/JARs while using exact same version. 我不明白如何在使用完全相同的版本时获得两种不同的行为/ JAR。

Any clue ? 任何线索? Any other experience using World Wind Java within Maven project ? 在Maven项目中使用World Wind Java的任何其他经验?

Thank you for your help, 谢谢您的帮助,

Some digging into the World Wind Java readme files seems to have turned up the issue: 一些挖掘World Wind Java自述文件似乎已经出现了问题:


JOGL Library Overview JOGL库概述

The JOGL library provides World Wind Java with (1) a Java binding to the OpenGL API, and (2) OpenGL contexts compatible with Java's AWT and Swing windowing toolkits: http://jogamp.org/jogl/www/ JOGL库为World Wind Java提供(1)与OpenGL API的Java绑定,以及(2)与Java的AWT和Swing窗口工具包兼容的OpenGL上下文: http//jogamp.org/jogl/www/

World Wind Java uses JOGL v2.1.5, released on 11 March 2014 and downloaded from: http://jogamp.org/deployment/v2.1.5/archive/jogamp-all-platforms.7z World Wind Java使用JOGL v2.1.5,于2014年3月11日发布,并从以下网址下载: http ://jogamp.org/deployment/v2.1.5/archive/jogamp-all-platforms.7z

The JOGL library compiled JAR files and README files are checked into the World Wind Java source, distributed with all World Wind Java builds and included in the World Wind Java Web Start deployment. JOGL库编译的JAR文件和README文件被检入World Wind Java源代码,该源代码随所有World Wind Java构建一起分发,并包含在World Wind Java Web Start部署中。 This is necessary in order ensure correct operation of World Wind Java, as changes in JOGL are occasionally unstable or incompatible with previous versions. 这对于确保World Wind Java的正确操作是必要的,因为JOGL中的更改偶尔会不稳定或与先前版本不兼容。 Additionally, World Wind Java's copy of the JOGL JAR files are modified to enable Web Start deployment outside of the jogamp.org domain. 此外,还修改了World Wind Java的JOGL JAR文件副本,以便在jogamp.org域之外启用Web Start部署。


Whoever put World Wind Java in the central repository should therefore have packaged and deployed the very specific JOGL/Gluegen Jars necessary to make it work. 因此,无论谁将World Wind Java放入中央存储库,都应该打包并部署使其工作所必需的非常特定的JOGL / Gluegen Jars。 In the mean time I'm going to extract and deploy these version to my own private repository. 与此同时,我将把这些版本提取并部署到我自己的私有存储库中。

If you want to use a library in Maven you should add the dependency to your project, there is no need to hunt for all transitive dependencies (unless the docs say otherwise). 如果要在Maven中使用库,则应该将依赖项添加到项目中,不需要寻找所有传递依赖项(除非文档另有说明)。 For the world wind I found the dependency on this site: http://maven-repository.com/artifact/gov.nasa/worldwind/2.0.0-986 对于世界风,我发现了对该网站的依赖: http//maven-repository.com/artifact/gov.nasa/worldwind/2.0.0-986

<dependency>
  <groupId>gov.nasa</groupId>
  <artifactId>worldwind</artifactId>
  <version>2.0.0-986</version>
</dependency>

It should work. 它应该工作。

One of the advantages of using Maven is that there is no need to know every jar needed to use every library, Maven will manage this. 使用Maven的一个优点是不需要知道每个库需要使用每个库,Maven将管理它。 In this case, the World Wind Maven dependency has it's own POM that declares all needed dependencies. 在这种情况下,World Wind Maven依赖项具有它自己的POM,它声明了所有需要的依赖项。 Maven will scan all POMs from all dependencies and will download all required JARs when needed. Maven将扫描所有依赖项中的所有POM,并在需要时下载所有必需的JAR。

There is no technical restriction having two files with the same name on different locations with different content. 在具有不同内容的不同位置上具有两个具有相同名称的文件没有技术限制。 Though I'd not recommend this - especially with library artifacts. 虽然我不推荐这个 - 特别是对于库工件。 This confuses people, like you, and drives them crazy sooner or later. 这会让人感到困惑,就像你一样,迟早会让他们发疯。

Why WorldWind Java team did that? 为什么WorldWind Java团队会这样做? Ask Responsible NASA Official: Patrick Hogan . 责任NASA官员:Patrick Hogan

Please rather use 2.1.5-01 instead of 2.1.5 because the latter had a big problem, something went wrong during its deployment: 请使用2.1.5-01而不是2.1.5,因为后者有一个大问题,在部署过程中出了问题:

http://jogamp.org/deployment/maven/org/jogamp/jogl/jogl-all/2.1.5-01/ http://jogamp.org/deployment/maven/org/jogamp/jogl/jogl-all/2.1.5-01/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM