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

Viewed 398

I have been developing an R package for ordinal and monotonic data named OCAPIS but algorithms are mainly built in Scala. So, I provide a FAT Jar with the package in /inst/java folder. 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. As a result, the package weights 37M and I doubt if CRAN would accept it.

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?

1 Answers

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

Alternatively you could create a separate package that only contains the jar file. Such a package might be accepted on CRAN if you can argue that it will be rather static. IIRC the tabularizer package works like that. In that case your main package could depend on the jar-package.

Alternatively you could host the jar-Package via drat on github. In that case your package wound only suggest the jar-package. All the functions would need to check if the jar-package is installed. See this R journal article for details.

For another possibility you can look at this answer.

Related