使用 Ivy 下载 LWJGL 本地程序 [英] Downloading LWJGL natives with Ivy

查看:30
本文介绍了使用 Ivy 下载 LWJGL 本地程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为个人项目设置 Ant + Ivy 构建.在我加入 LWJGL 之前,一切都很有意义,并且运行良好.LWJGL 中的所有内容都已解决,除了本地人.

I'm trying to set up an Ant + Ivy build for a personal project. Everything was making sense, and working nicely, until I got to LWJGL. Everything from LWJGL is resolved, except the natives.

他们网站上的 Readme.md 使它看起来像是可以通过 Ivy 获得这些:

The Readme.md on their website makes it seem that it is possible to get these through Ivy:

LWJGL 3 可以与 Maven/Gradle/Ivy 一起使用,如下依赖:

LWJGL 3 can be used with Maven/Gradle/Ivy, with the following dependencies:

  • org.lwjgl:lwjgl:${version}
  • org.lwjgl:lwjgl-platform:${version}:natives-windows
  • org.lwjgl:lwjgl-platform:${version}:natives-linux
  • org.lwjgl:lwjgl-platform:${version}:natives-osx

我想要的文件肯定在maven上中央存储库,所以必须有办法让它们通过 Ivy.我已经像这样设置了我的 ivy.xml 文件:

The files I want are definitely on the maven central repository, so there must be a way of getting them through Ivy. I have set up my ivy.xml file like so:

<ivy-module version="1.0" xmlns:extra="http://ant.apache.org/ivy/extra">
    <info organisation="foo" module="bar"/>
    <publications>
        <artifact name="baz" type="jar"/>
    </publications>
    <dependencies>
        <dependency org="org.lwjgl" name="lwjgl" rev="3.0.0a"/>
        <dependency org="org.lwjgl" name="lwjgl-platform" rev="3.0.0a" extra:classifier="natives-linux"/>
        <dependency org="org.lwjgl" name="lwjgl-platform" rev="3.0.0a" extra:classifier="natives-osx"/>
        <dependency org="org.lwjgl" name="lwjgl-platform" rev="3.0.0a" extra:classifier="natives-windows"/>
    </dependencies>
</ivy-module>

以及我在 ant 中的解析任务:

And my resolve task in ant:

<target name="resolve" description="Retrive dependencies with Ivy">
    <ivy:retrieve/>
</target>

出于某种原因,这会从org.lwjgl:lwjgl:3.0.0a"(jar、javadoc 和源代码)下载所有工件,但不会从org.lwjgl:lwjgl-platform"下载任何本机:3.0.0a".我在谷歌上花了很长时间,终于在Github上别人的ivy.xml文件中找到了extra:classifier"语法,但无济于事(我的希望太早了).一定是我遗漏了什么,所以我希望 SO 上的人可以提供帮助.

For some reason, this downloads all the artifacts from "org.lwjgl:lwjgl:3.0.0a" (jar, javadoc, and sources), but does not download any of the natives from "org.lwjgl:lwjgl-platform:3.0.0a". I spent a long time on Google, and finally managed to find the "extra:classifier" syntax in someone else's ivy.xml file on Github, but to no avail (I got my hopes up too early). There must be something I'm missing, so I hope someone on SO can help.

推荐答案

必须在 ivy 依赖项声明中显式检索 Maven 模块中的额外工件.

Extra artifacts in Maven modules must be explicitly retrieved in the ivy dependency declaration.

您还需要指定检索任务中使用的模式,因为分类器"是 Maven 特定的标记并且是可选的.

You'll also need to specify the pattern used in the retrieve task, because "classifier" is a Maven specific tag and optional.

├── build.xml
├── ivy.xml
└── target
    └── lib
        ├── lwjgl-3.0.0a.jar
        ├── lwjgl-platform-3.0.0a-natives-linux.jar
        ├── lwjgl-platform-3.0.0a-natives-osx.jar
        └── lwjgl-platform-3.0.0a-natives-windows.jar

build.xml

<project name="demo" default="resolve" xmlns:ivy="antlib:org.apache.ivy.ant">

    <property name="build.dir" location="target"/>

    <target name="resolve">
        <ivy:retrieve pattern="${build.dir}/lib/[artifact]-[revision](-[classifier]).[ext]"/>
    </target>

</project>

ivy.xml

<ivy-module version="1.0" xmlns:extra="http://ant.apache.org/ivy/extra">
  <info organisation="foo" module="bar"/>
  <dependencies>
    <dependency org="org.lwjgl" name="lwjgl" rev="3.0.0a" conf="default"/>

    <dependency org="org.lwjgl" name="lwjgl-platform" rev="3.0.0a">
      <artifact name="lwjgl-platform" type="jar" extra:classifier="natives-linux"/>
      <artifact name="lwjgl-platform" type="jar" extra:classifier="natives-osx"/>
      <artifact name="lwjgl-platform" type="jar" extra:classifier="natives-windows"/>
    </dependency>
  </dependencies>
</ivy-module>

这篇关于使用 Ivy 下载 LWJGL 本地程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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