new to jenkins and community so go easy on me.
I am tasked with setting test and build pipeline for our class project,
I am trying to build maven project, its pom.xml file containes frontend-maven-plugin and runnning test or packaging always fails on that plugin, if i remove it test work but packaging wont because the plugin is required to install node and npm
I should note that mvn test and mvn clean install commands work perfectly when executing on my machine using the same mvn, java, node and npm versions
I am new user so i cant upload files so jenkins file and jenkins job log are in these two pastebins:
Error happens both when I run Jenkins server in docker or as a linux service
I can provide more info if necessary and any help is higly appreciated,
Thank you for your time and have a great day
it looks like its failing due to npm install, but i can’t find any output for npm install in there.
that usually means some sort of env variable is missing or different. Or some other external dependancy is missing.
Older versions of node often needed python to install C based code.
Thank you for your reply,
It is not really problem I am able to troubleshoot with my knowledge and timeframe,
Found a workaround tho,
So for future references and whomever finds themself at this post:
Use multistage dockerfile build
In the first stage use node docker image and run your npm commands to download node modules
In the second stage use maven docker image and copy node modules from the first stage and then run mvn commands
Something like this:
FROM node:16.17.1-alpine3.15 as node_modules
RUN mkdir /workdir/
COPY package.json .
COPY rollup.config.js .
COPY ./src ./src/
RUN npm install
RUN npm run bundle
FROM maven:3.8-openjdk-11 AS build
COPY --from=node_modules /workdir .
COPY ./.git ./.git/
COPY pom.xml .
COPY ./local-repo ./local-repo/
COPY checkstyle-codedefenders.xml .
RUN mvn test # or something else or call mvn test in the jenkins step