mvndaemon / homebrew-mvnd

This is a homebrew tap for mvnd, the Maven Daemon.
Apache License 2.0
7 stars 6 forks source link

release.sh does not follow GitHub's API redirect; download URL guessing gives 404 for `1.0-m6-xx`; support many builds #9

Closed pybeaudouin closed 11 months ago

pybeaudouin commented 12 months ago

Hello, in anticipation of mvnd 1.0-m7 I looked at your repo to update the Brew formula. Thank you for your work!

I found a few issues:

API redirects are unsupported

Calling https://api.github.com/repos/mvndaemon/mvnd/releases/latest now redirects to https://api.github.com/repositories/210029529/releases/latest with the response body:

{
  "message": "Moved Permanently",
  "url": "https://api.github.com/repositories/210029529/releases/latest",
  "documentation_url": "https://docs.github.com/v3/#http-redirects"
}

The quickest fix would be to update the URL in release.sh, but the repository number is opaque while the repository name is human-friendly. For security, I suggest to simply follow GitHub's redirect. I will submit a merge request shortly after submitting this issue.

URL guessing yields HTTP 404 Not Found errors

At the time of writing, https://github.com/apache/maven-mvnd/releases/download/1.0-m6/maven-mvnd-1.0-m6-m40-darwin-amd64.zip gives a Not Found error.

In order to find the download URL, I suggest searching for the platform string (darwin-amd64.zip).

This leads to another issue: even a flavour may have many builds. At the time of writing, 1.0-m6 darwin-amd64.zip is available at the following URLs:

I suggest to take the last URL.

gnodet commented 11 months ago

@pybeaudouin The m39 flavour includes Maven 3.9.x while the m40 flavour includes Maven 4.0.0-alpha. It would be nice if users could somehow choose which one they want. Switching between those is what made me switch to sdkman for java / maven.

pybeaudouin commented 11 months ago

@gnodet I like the idea! I think that's doable using Homebrew versions. I can look into that if you're interested.

Closing as per https://github.com/mvndaemon/homebrew-mvnd/pull/10#issuecomment-1645229463