1

I'm an on M1 MAC trying to use the Azul jdk: https://cdn.azul.com/zulu/bin/zulu8.62.0.19-ca-jdk8.0.332-macosx_aarch64.dmg

I've installed it (see outputs below):

java -version

openjdk version "1.8.0_345"
OpenJDK Runtime Environment (Zulu 8.64.0.19-CA-macos-aarch64) (build 1.8.0_345-b01)
OpenJDK 64-Bit Server VM (Zulu 8.64.0.19-CA-macos-aarch64) (build 25.345-b01, mixed mode)

javac -version

javac 1.8.0_345

My error comes when I do a mvn clean install -e. This is the output:

enter image description here

I've also upgraded the frontend-maven-plugin to 1.11.0, which I've seen is necessary for the M1. At this point, I'm not sure where to go. Below is the pom.xml for ems_react_ui

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.inc.gem</groupId>
    <artifactId>ems_react_ui</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>

    <parent>
        <groupId>com.inc</groupId>
        <artifactId>gem</artifactId>
        <version>1.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
    </properties>

    <build>
        <finalName>ems_react_ui</finalName>
        <plugins>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>../ems/src/main/webapp/scripts/react</directory>
                            <includes>
                                <include>**/**</include>
                            </includes>
                            <followSymlinks>false</followSymlinks>
                        </fileset>
                        <fileset>
                            <directory>./node</directory>
                            <includes>
                                <include>**/**</include>
                            </includes>
                            <followSymlinks>false</followSymlinks>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.github.eirslett</groupId>
                <artifactId>frontend-maven-plugin</artifactId>
                <version>1.11.0</version>
                <configuration>
                    <workingDirectory>./</workingDirectory>
                    <environmentVariables>
                        <!-- Avoid certificates issues for npm install, needed behind a corporate proxy -->
                        <NODE_TLS_REJECT_UNAUTHORIZED>0</NODE_TLS_REJECT_UNAUTHORIZED>
                    </environmentVariables>
                </configuration>
                <executions>
                    <execution>
                        <id>install node and npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                        <configuration>
                            <nodeVersion>v12.14.1</nodeVersion>
                            <npmVersion>3.10.8</npmVersion>
                        </configuration>
                    </execution>
                    <execution>
                        <!-- npm runs in the docker context and needs to be normal user for execution -->
                        <id>npm config set user root</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>config set user root</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm i</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>i</arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm run build</id>
                        <goals>
                            <goal>npm</goal>
                        </goals>
                        <configuration>
                            <arguments>run build</arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>copy-react-to-webapp</id>
                        <phase>install</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>../ems/src/main/webapp/scripts/react/dist</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>./dist</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-mainjs-to-webapp</id>
                        <phase>install</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>../ems/src/main/webapp/scripts/react/</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>./</directory>
                                    <includes>
                                        <include>main.js</include>
                                    </includes>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Output of echo $PATH =

/Users/danieljohnson/.pyenv/shims:/Users/danieljohnson/.pyenv/bin:/Users/danieljohnson/.nvm/versions/node/v10.24.1/bin:/usr/local/opt/python@3.7/bin:/Library/Frameworks/Python.framework/Versions/3.8/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/opt/python@3.7/bin/pip3:/usr/local/opt/python@3.7/bin/python3:/Applications/Postgres.app/Contents/Versions/latest/bin
cyberbrain
  • 3,433
  • 1
  • 12
  • 22
Daniel Johnson
  • 193
  • 2
  • 14
  • 1
    Do you have npm installed and on the PATH? – Thorbjørn Ravn Andersen Aug 17 '22 at 17:32
  • @ThorbjørnRavnAndersen I just added the output of $PATH above. It doesn't look like it. Could that be causing the problem? npm -v gives me the output: 6.14.12 – Daniel Johnson Aug 17 '22 at 17:35
  • Ah the goal had the command as the id - baffled me a bit. Consider if the two words in `` should be split. – Thorbjørn Ravn Andersen Aug 17 '22 at 17:48
  • Yea I see what you mean, but a colleague (on a non M1 mac) was able to bulid with those '' as they are currently listed above – Daniel Johnson Aug 17 '22 at 17:56
  • @ThorbjørnRavnAndersen frontend-maven-plugin usually installs npm on its own, you don't need to have it installed locally as precondition for the build. – cyberbrain Aug 17 '22 at 18:09
  • 1
    As your build emits a webpack error message, I'm quite sure that npm is existing. I would think it is a npm package that needs platform specific binaries. Please try to install npm locally (or use the downloaded one after you startet the maven build) to start a `npm run build` without maven to see if that build succeeds. – cyberbrain Aug 17 '22 at 18:13
  • 1
    I also would recommend to prefix the ids of your executions with a counter in the desired order of execution - just in case if there are two or more binding to the same maven phase. Don't know if maven behaves similar on all platforms here. – cyberbrain Aug 17 '22 at 18:16

1 Answers1

0

Version 14.15.4 fixed this isse for me (and I removed the npm version)

                        <id>install node and npm</id>
                        <goals>
                            <goal>install-node-and-npm</goal>
                        </goals>
                        <configuration>
                            <nodeVersion>v14.15.4</nodeVersion>
                        </configuration>
                    
Daniel Johnson
  • 193
  • 2
  • 14
  • 1
    Yup, this fix looks ok; your build didn't fail because of Maven, the Maven setup looks ok. However, as you can see in the screenshot, Maven runs `npm run build`. npm is a Javascript build tool, and needs "node" to run, and apparently "node" wasn't the right version. Normally people install these tools separately, not through Maven. – Vlad Dinulescu Aug 24 '22 at 08:03