gradle-node-plugin
gradle-node-plugin copied to clipboard
unable to download a latest-v.x version
https://nodejs.org/dist/
node {
download.set(true)
version.set("latest-v14.x")
}
Could not determine the dependencies of task ':nodeSetup'.
> Failed to query the value of task ':nodeSetup' property 'nodeArchiveFile'.
> Could not resolve all files for configuration ':detachedConfiguration1'.
> Could not find org.nodejs:node:latest-v14.x.
Searched in the following locations:
- https://nodejs.org/dist/vlatest-v14.x/node-vlatest-v14.x-linux-x64.tar.gz
Required by:
project :
This is the same issue as #54
There's a workaround in https://github.com/node-gradle/gradle-node-plugin/issues/54#issuecomment-581950868
But the short of it is that you'll have to use distBaseUrl = null and manually add an IvyRepository, if you want dynamic versions e.g. 14.+ you'll also need the ComponentMetadataVersionLister from there (or a similar one)
But in general I advise strongly against dynamic versions, reproducible builds are good and if you want to run bleeding edge versions something like ben-manes/gradle-versions-plugin + patrikerdes/gradle-use-latest-versions-plugin and generating PR/MRs.
Which unfortunately also requires you to use distBaseUrl = null and manually add an IvyRepository with a ComponentMetadataVersionLister but at least you'll have reproducible builds and easy one-click upgrades :-)
well, I don't want to run bleeding edge builds, this is tangentially related to #183 as I really just want to say NodeVersion.of(14) since that would be the latest stable. Ideally, a patch release wouldn't break things. If you already had a version of 14 installed it shouldn't feel the need to go fetch a new one either. I'm guessing by what you're saying this would use gradles built in dependency management, which ultimately sounds like a better solution than doing it the way you're currently doing perhaps. since that also involves package locks. To be fair in my case I'm only planning on using node for husky/prettier hooks, since Java formatting via java code isn't really there yet (unless you like the google styles).
Oh I missed the follow-up, but yeah, https://github.com/node-gradle/gradle-node-plugin/issues/54#issuecomment-581950868 sounds like what you want, NodeVersion.of(14) is not strictly equivalent to 14.+ but you can fulfill NodeVersion.of(14) with version.set("14.0.0") since even the earliest version of 14 satisfies of(14), whereas 14+ would give you the latest version of 14.
yeah, but the equivalent in java will grab the latest unless you already have a copy on the path (or otherwise already downloaded) that fulfills it.