javafx-maven-plugin icon indicating copy to clipboard operation
javafx-maven-plugin copied to clipboard

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

Open Doc-98 opened this issue 9 months ago • 0 comments

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.

Doc-98 avatar Feb 19 '25 11:02 Doc-98