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

This commit is contained in:
Martin Bergljung
2016-10-10 10:10:48 +01:00
parent 051e967240
commit 723b309670

View File

@@ -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"),