git-code-format-maven-plugin: Cannot find maven executable

Hi,

Thank you for the great plugin. I am trying to integrate this in an existing project and I am facing a problem how the pre-commit is generated.

The Pre-Commit Hook script that is generated for the project looks like this:

#!/bin/bash
set -e
"<project-path>/mvn" -f "<project-path>/pom.xml" com.cosmium.code:git-code-format-maven-plugin:on-pre-comit

The problem is how path to maven executable is generated <project-path>/mvn. When the pre-commit hook is called, maven cannot be found on this path and the hook fails.

I tried using a .mvn folder in root directory of the project with wrapper folder and then a MavenWrapperDownloader.java (I copied it from a Spring Project), but this did not seem to help.

Is there a way we can disable this? So I can say write mvn instead of <project-path>/mvn in the bash script?

If not, would you be open to accepting a PR for this? probably also for a previous version of the plugin? (v2.7)

Thanks!

EDIT: I think this is related to tooling. When I run mvn clean install via IntelliJ and IntelliJ uses bundled maven, then the plugin do not get the correct path to maven. But I think there still should be an option to configure this, for let’s say teams where updating IDEs for everyone is not desired. Anyways, I would be happy to submit a PR if this is something that the maintainers would consider as an option

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 15 (6 by maintainers)

Most upvoted comments

Ok no problem for version 2.