eirslett / frontend-maven-plugin

"Maven-node-grunt-gulp-npm-node-plugin to end all maven-node-grunt-gulp-npm-plugins." A Maven plugin that downloads/installs Node and NPM locally, runs NPM install, Grunt, Gulp and/or Karma.
Apache License 2.0
4.22k stars 868 forks source link

Wrong OS guessed on AIX system #1000

Closed rudgal closed 2 years ago

rudgal commented 2 years ago

Hello there,

I'm using frontend-plugins-1.12.0 with Jenkins 2.263.4 running on an AIX platform. Build fails with following error:

[INFO] Downloading https://nodejs.org/dist/v14.17.5/node-v14.17.5-linux-ppc64.tar.gz to /scratch/nobackup/jenkins/repository/com/github/eirslett/node/14.17.5/node-14.17.5-linux-ppc64.tar.gz
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.12.0:install-node-and-npm (install node and npm) on project xxxxx: Could not download Node.js: Got error code 404 from the server. -> [Help 1]

node-v14.17.5-linux-ppc64.tar.gz is obviously not a valid binary.

Digging into the code, I think that the plattform was not detected correctly. The java system os properties on the AIX system are provided as follows:

    os.arch = ppc64
    os.encoding = ISO8859-15
    os.name = AIX
    os.version = 7.2

Due to case-sensitive comparison OS.Linux is detected in Platform.java, but should have been OS.AIX:

    public static OS guess() {
        final String osName = System.getProperty("os.name");
        return  osName.contains("Windows") ? OS.Windows :
                osName.contains("Mac") ? OS.Mac :
                        osName.contains("SunOS") ? OS.SunOS :
                            osName.contains("Aix") ? OS.AIX :
                                OS.Linux;
    }

Can we alter the comparison to osName.contains("AIX") in capital letters here? Or maybe have an case-insensitive check?

Thanks in advance!