Skip to content

Cannot find maven executable #71

Open
@varijkapil13

Description

@varijkapil13

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions