Skip to content

org.apache.maven.plugin.MojoExecutionException: Could not make working directory... #183

Description

@Doc-98

While I was trying to install the plugin I encountered this error in the testining phase.
I decided to snoop around the test cases to understand what was happenning and I managed to fix my issue by slightly changing the test case.

Unfortunately I do not have the transcript from my shell, but the error reported was the one in the title and the directory listed was something like:
"C:[...]\C:[...]"

So basically I knew that in some place there was an impossible directory that was being used.

I found this piece of code by following the lines listed in the error log:

void handleWorkingDirectory() throws MojoExecutionException {
        if (workingDirectory == null) {
            workingDirectory = basedir;
        }

        if (!workingDirectory.exists()) {
            getLog().debug("Making working directory '" + workingDirectory.getAbsolutePath() + "'.");
            if (!workingDirectory.mkdirs()) {
                throw new MojoExecutionException("Could not make working directory: '" + workingDirectory.getAbsolutePath() + "'");
            }
        }
    }

I just changed the first part in:
workingDirectory = new File(basedir.getAbsolutePath().substring(basedir.getAbsolutePath().indexOf("C:\\"), 4));

This seemd to work.
I couldn't find this issue anywere else, so I tried to fix it by myself.

I don't know if I did something wrong to setup maven or anything else, so maybe I caused my own problem.
I hope this is helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions