Commit 723b3096 authored by Martin Bergljung's avatar Martin Bergljung
Browse files

Added validation of existence of alfresco-global-*.properties files, #416

parent 051e9672
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.FileUtils;
import org.zeroturnaround.zip.ZipUtil;

import java.io.*;
@@ -562,7 +563,7 @@ public class RunMojo extends AbstractMojo {
     * @throws MojoExecutionException
     */
    protected void renameAlfrescoGlobalProperties() throws MojoExecutionException {
        String alfrescoGlobalFilePath = "${project.build.testOutputDirectory}/alfresco-global-";
        String alfrescoGlobalFilePath = project.getBuild().getTestOutputDirectory() + "/alfresco-global-";
        if (enableH2) {
            alfrescoGlobalFilePath += "h2.properties";
            getLog().info("Renaming alfresco-global-h2.properties to alfresco-global.properties");
@@ -579,6 +580,15 @@ public class RunMojo extends AbstractMojo {
            throw new MojoExecutionException("Invalid database configuration, use enableH2, enableMySQL, " +
                    "enablePostgreSQL, or enabaleEnterpriseDb");
        }

        if (!FileUtils.fileExists(alfrescoGlobalFilePath)) {
            throw new MojoExecutionException("Missing file: " + alfrescoGlobalFilePath + ", when converting from older " +
                    "SDK versions generate an SDK 3 AIO or Platform JAR project and copy " +
                    "alfresco-global-*.properties files from it. Then configure any custom settings from old SDK " +
                    "project repo/src/main/properties/local/alfresco-global.properties file in the new " +
                    "alfresco-global-h2.properties file, or other config file corresponding to the database you are using.");
        }

        executeMojo(
                plugin(
                        groupId("com.coderplus.maven.plugins"),