Gitlab-runner maven build fails with Permission denied message BUT succeeds with debug option on

95 views Asked by At

I'm trying to build a Java project with maven image with Gitlab-runner. There was no issue until yesterday, I encountered the error below saying that "Permission is denied".

This is the command that I run:

mvn clean install -P prd -Dmaven.test.skip=true

But once I add -X option to the command, the build suddenly works. How on earth is debug mode related to the permission of a user?

Since I'm pretty new to programming, I have a near-zero foundation in how build works but this issue seems to be something unheard of.

Can anyone give an insight on this?

Thank you.

[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ gra-api ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2594 source files to /home/gitlab-runner/builds/CsiK6vc5/0/p202008_0045_gra/graapi/graapi/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.536 s
[INFO] Finished at: 2023-12-06T21:23:20+09:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project gra-api: Fatal error compiling: Error creating file with javac arguments: Permission denied -> [Help 1]
[ERROR] 

I've changed the Maven compiler version but didn't work, Checked permission for the Gitlab-runner account and it was fine, tried to use sudo when running the command, but that didn't work either.

1

There are 1 answers

0
JINWON KIM On

Apparaently the maven was writing files to /tmp folder, I don't know the details, would be good if someone can elaborate on this.

But since the /tmp folder was belong to root and so gitlab-runner had no permission to write files to the folder,

I've changed the permission for all users to write and boom no more errors.

Got the answer from the questions below !

Permission denied when using mvn cobertura plugin