public void execute()

in src/main/java/org/apache/maven/plugins/jmod/JModCreateMojo.java [290:330]


    public void execute() throws MojoExecutionException, MojoFailureException {
        try {
            String jModExecutable = getJModExecutable();
            File jModExecuteableFile = new File(jModExecutable);
            javaHome = jModExecuteableFile.getParentFile().getParentFile();
            File jmodsFolderJDK = new File(javaHome, JMODS);
            getLog().debug("Parent: " + javaHome.getAbsolutePath());
            getLog().debug("jmodsFolder: " + jmodsFolderJDK.getAbsolutePath());

            preparePaths();

            failIfParametersAreNotInTheirValidValueRanges();

            getLog().debug("Toolchain in maven-jmod-plugin: jmod [ " + jModExecutable + " ]");

            // We need to put the resulting x.jmod files into jmods folder otherwise is
            // seemed to be not working.
            // Check why?
            File modsFolder = new File(outputDirectory, "jmods");
            File resultingJModFile = new File(modsFolder, outputFileName + ".jmod");

            deleteOutputIfAlreadyExists(resultingJModFile);

            // create the jmods folder...
            modsFolder.mkdirs();

            Commandline cmd = createJModCreateCommandLine(resultingJModFile);
            cmd.setExecutable(jModExecutable);

            executeCommand(cmd, outputDirectory);

            if (projectHasAlreadySetAnArtifact()) {
                throw new MojoExecutionException("You have to use a classifier "
                        + "to attach supplemental artifacts to the project instead of replacing them.");
            }

            getProject().getArtifact().setFile(resultingJModFile);
        } catch (IOException e) {
            throw new MojoFailureException("Unable to find jmod command: " + e.getMessage(), e);
        }
    }