Configuration/Plugin to format java code in gitlab

1

I am using gitlab to commit/synchronize my java code. I am my standard xml file to format maven java code. I have configured pre-commit hook which works perfectly ok. It formats the code and push it into github. But problem is, this pre-commit hook must be present in every other individual. I want to configure format plugin in my gitlab workspace, so that whomsoever push, the code will get formatted they don't have configured pre-commit hook. How can i do this?

user10144071

Posted 2019-08-03T06:18:28.110

Reputation: 11

Answers

2

You are probably looking for Custom server-side Git hooks.

A GitLab server administrator can add such a script file under the project’s repository directory in a new directory called custom_hooks.

See the above link for details.

harrymc

Posted 2019-08-03T06:18:28.110

Reputation: 306 093

What will be my approach to format java code – user10144071 – 2019-08-03T07:19:04.917

In my maven project's pom.xml i have specified formatter-maven-plugin so i custom_hooks will be executing mvn commands? – user10144071 – 2019-08-03T07:20:42.190

You might be referring to GitLab Maven Repository, but I don't have experience with that.

– harrymc – 2019-08-03T07:30:20.737