简体   繁体   English

从 Github URL 下载包 JAR 到 R 包中的 /inst/java

[英]Download package JAR from Github URL to /inst/java in an R package

I have been developing an R package for ordinal and monotonic data named OCAPIS but algorithms are mainly built in Scala.我一直在为名为OCAPIS 的序数和单调数据开发一个 R 包,但算法主要是用 Scala 构建的。 So, I provide a FAT Jar with the package in /inst/java folder.因此,我在/inst/java文件夹中提供了一个带有包的 FAT Jar Providing that FAT JAR is intended to facilitate the installation to the user, as he/she will not need to install the Scala Breeze library used for algebraic and numeric operations.提供 FAT JAR 旨在方便用户安装,因为他/她不需要安装用于代数和数字运算的 Scala Breeze库。 As a result, the package weights 37M and I doubt if CRAN would accept it.因此,包裹重 37M,我怀疑 CRAN 是否会接受它。

So, is there a way that I can specify to download the .Jar from, for example, the Github repository and place it under /inst/java when installing the package?那么,有没有一种方法可以指定从例如Github 存储库下载 .Jar 并在安装包时将其放在/inst/java下?

You could provide a function that downloads the jar to the package and add that to the installation instructions See for example https://github.com/rkrug/plantuml/blob/master/R/updatePlantumlJar.R您可以提供一个功能,将 jar 下载到包中并将其添加到安装说明中,例如参见https://github.com/rkrug/plantuml/blob/master/R/updatePlantumlJar.R

Alternatively you could create a separate package that only contains the jar file.或者,您可以创建一个仅包含 jar 文件的单独包。 Such a package might be accepted on CRAN if you can argue that it will be rather static.如果您可以争辩说它是相当静态的,那么 CRAN 可能会接受这样的包。 IIRC the tabularizer package works like that. IIRC tabularizer 包就是这样工作的。 In that case your main package could depend on the jar-package.在这种情况下,您的主包可能依赖于 jar 包。

Alternatively you could host the jar-Package via drat on github.或者,您可以通过 github 上的 drat 托管 jar-Package。 In that case your package wound only suggest the jar-package.在这种情况下,您的包裹伤口仅建议使用 jar-package。 All the functions would need to check if the jar-package is installed.所有功能都需要检查是否安装了 jar-package。 See this R journal article for details.有关详细信息,请参阅此 R 期刊文章

For another possibility you can look at this answer .对于另一种可能性,您可以查看此答案

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

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