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
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/
WORKDIR /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
...