Remove Solr and custom databases (including H2) from the plugin. This now requires these services to be available externally

This commit is contained in:
Ole Hejlskov 2018-10-05 15:21:13 +02:00
parent 7edac56eed
commit 52a6938a66
3 changed files with 20 additions and 638 deletions

View File

@ -58,15 +58,11 @@ public abstract class AbstractRunMojo extends AbstractMojo {
public static final String MAVEN_REPLACER_PLUGIN_VERSION = "1.5.3";
public static final String MAVEN_RESOURCE_PLUGIN_VERSION = "2.7";
public static final String MAVEN_TOMCAT7_PLUGIN_VERSION = "2.2";
public static final String MAVEN_BUILD_HELPER_PLUGIN_VERSION = "1.12";
public static final String PLATFORM_WAR_PREFIX_NAME = "platform";
public static final String SHARE_WAR_PREFIX_NAME = "share";
public static final String ALFRESCO_ENTERPRISE_EDITION = "enterprise";
public static final String ALFRESCO_COMMUNITY_EDITION = "community";
@Component
protected MavenProject project;
@ -76,8 +72,7 @@ public abstract class AbstractRunMojo extends AbstractMojo {
@Component
protected BuildPluginManager pluginManager;
@Parameter(property = "reactorProjects", required = true, readonly = true)
protected List<MavenProject> reactorProjects;
/**
* The following properties that start with 'maven.' are used to control the
@ -90,10 +85,7 @@ public abstract class AbstractRunMojo extends AbstractMojo {
* <artifactId>alfresco-maven-plugin</artifactId>
* <version>3.0.0</version>
* <configuration>
* <alfrescoEdition>community</alfrescoEdition>
* <enableH2>true</enableH2>
* <enablePlatform>true</enablePlatform>
* <enableSolr>true</enableSolr>
* <enableShare>false</enableShare>*
* <platformModules>
* <moduleDependency>
@ -109,36 +101,6 @@ public abstract class AbstractRunMojo extends AbstractMojo {
* </pre>
*/
/**
* Switch to enable/disable the Apache Solr 4 web application when running embedded Tomcat.
*/
@Parameter(property = "maven.alfresco.enableSolr", defaultValue = "true")
protected boolean enableSolr;
/**
* Switch to enable/disable the H2 database when running embedded Tomcat.
* This also brings in the needed H2 database scripts.
*/
@Parameter(property = "maven.alfresco.enableH2", defaultValue = "false")
protected boolean enableH2;
/**
* Switch to enable/disable the MySQL database when running embedded Tomcat.
*/
@Parameter(property = "maven.alfresco.enableMySQL", defaultValue = "false")
protected boolean enableMySQL;
/**
* Switch to enable/disable the PostgreSQL database when running embedded Tomcat.
*/
@Parameter(property = "maven.alfresco.enablePostgreSQL", defaultValue = "false")
protected boolean enablePostgreSQL;
/**
* Switch to enable/disable the Enterprise database (such as Oracle or MS SQL Server) when running embedded Tomcat.
*/
@Parameter(property = "maven.alfresco.enableEnterpriseDb", defaultValue = "false")
protected boolean enableEnterpriseDb;
/**
* Switch to enable/disable the Platform/Repository (alfresco.war) when running embedded Tomcat.
@ -223,11 +185,6 @@ public abstract class AbstractRunMojo extends AbstractMojo {
protected List<ModuleDependency> shareModules;
/**
* Community Edition or Enterprise Edition? (i.e community or enterprise)
*/
@Parameter(property = "maven.alfresco.edition", defaultValue = ALFRESCO_COMMUNITY_EDITION)
protected String alfrescoEdition;
/**
* Tomcat Dependencies that should be added to the Embedded Tomcat configuration before start.
@ -272,34 +229,27 @@ public abstract class AbstractRunMojo extends AbstractMojo {
@Parameter(property = "alfresco.groupId", defaultValue = "org.alfresco")
protected String alfrescoGroupId;
@Parameter(property = "alfresco.platform.war.artifactId", defaultValue = "alfresco-platform")
@Parameter(property = "alfresco.platform.war.artifactId", defaultValue = "content-services-community")
protected String alfrescoPlatformWarArtifactId;
@Parameter(property = "alfresco.share.war.artifactId", defaultValue = "share")
protected String alfrescoShareWarArtifactId;
@Parameter(property = "alfresco.solr.artifactId", defaultValue = "alfresco-solr4")
protected String alfrescoSolrArtifactId;
@Parameter(property = "alfresco.api.explorer.artifactId", defaultValue = "api-explorer")
protected String alfrescoApiExplorerArtifactId;
@Parameter(property = "alfresco.platform.version", defaultValue = "5.2.f")
@Parameter(property = "alfresco.platform.version", defaultValue = "6.0.7-ga")
protected String alfrescoPlatformVersion;
@Parameter(property = "alfresco.share.version", defaultValue = "5.2.e")
@Parameter(property = "alfresco.share.version", defaultValue = "6.0.7-ga")
protected String alfrescoShareVersion;
@Parameter(property = "alfresco.api.explorer.version", defaultValue = "5.2.e")
@Parameter(property = "alfresco.api.explorer.version", defaultValue = "6.0.7-ga")
protected String alfrescoApiExplorerVersion;
/**
* Directory that contains the Alfresco Solr 4 configuration
*/
@Parameter(property = "solr.home", defaultValue = "${project.basedir}/${alfresco.data.location}/solr")
protected String solrHome;
/**
* Maven GAV properties for customized alfresco.war and share.war
@ -349,314 +299,21 @@ public abstract class AbstractRunMojo extends AbstractMojo {
return false;
}
}
/**
* Download and unpack the Solr 4 configuration as we don't have it in the project.
* It will reside under /alf_data_dev/solr
*
* @throws MojoExecutionException
*/
protected void unpackSolrConfig() throws MojoExecutionException {
getLog().info("Unpacking Solr config");
executeMojo(
plugin(
groupId("org.apache.maven.plugins"),
artifactId("maven-dependency-plugin"),
version(MAVEN_DEPENDENCY_PLUGIN_VERSION)
),
goal("unpack"),
configuration(
element(name("outputDirectory"), solrHome),
element(name("artifactItems"),
element(name("artifactItem"),
element(name("groupId"), alfrescoGroupId),
element(name("artifactId"), getSolrArtifactId()),
element(name("version"), alfrescoPlatformVersion),
// The Solr config is not in a special file with classifier config if <= 4.2
isPlatformVersionLtOrEqTo42() ? element(name("classifier"), "") : element(name("classifier"), "config"),
element(name("type"), "zip")
)
)
),
execEnv
);
}
/**
* For windows paths, convert single \ to / for the ${alfresco.solr.data.dir} path,
* by default it will be c:\bla\, we need forward slash or double backslash.
*
* @throws MojoExecutionException
*/
protected void fixSolrHomePath() throws MojoExecutionException {
getLog().info("Fix Solr Home Path to work in Windows");
executeMojo(
plugin(
groupId("org.codehaus.mojo"),
artifactId("build-helper-maven-plugin"),
version(MAVEN_BUILD_HELPER_PLUGIN_VERSION)
),
goal("regex-property"),
configuration(
element(name("name"), "solrDataDir"),
element(name("value"), solrHome),
element(name("regex"), "\\\\"),
element(name("replacement"), "/"),
element(name("failIfNoMatch"), "false")
),
execEnv
);
}
/**
* Copy custom solr configuration files over, so a
* developer can overwrite any files needed
*
* @throws MojoExecutionException
*/
protected void copySolrCustomConfig() throws MojoExecutionException {
getLog().info("Copying custom Solr config");
executeMojo(
plugin(
groupId("org.apache.maven.plugins"),
artifactId("maven-resources-plugin"),
version(MAVEN_RESOURCE_PLUGIN_VERSION)
),
goal("copy-resources"),
configuration(
element(name("outputDirectory"), solrHome),
element(name("overwrite"), "true"),
element(name("resources"),
element(name("resource"),
element(name("directory"), "src/test/resources/solr"),
element(name("filtering"), "true")
)
)
),
execEnv
);
}
/**
* Replace property placeholders in configuration files for the cores, so the
* index files can be found for each core when Solr starts up.
*
* @throws MojoExecutionException
*/
protected void replaceSolrConfigProperties() throws MojoExecutionException {
getLog().info("Replacing Solr config properties");
executeMojo(
plugin(
groupId("com.google.code.maven-replacer-plugin"),
artifactId("replacer"),
version(MAVEN_REPLACER_PLUGIN_VERSION)
),
goal("replace"),
configuration(
element(name("regex"), "false"),
element(name("includes"),
element(name("include"), solrHome + "/archive-SpacesStore/conf/solrcore.properties"),
element(name("include"), solrHome + "/workspace-SpacesStore/conf/solrcore.properties")
),
element(name("replacements"),
element(name("replacement"),
element(name("token"), "@@ALFRESCO_SOLR4_DATA_DIR@@"),
element(name("value"), "${solrDataDir}/index")
),
element(name("replacement"),
element(name("token"), "@@ALFRESCO_SOLR_DIR@@"),
element(name("value"), "${solrDataDir}/index")
),
element(name("replacement"),
element(name("token"), "alfresco.port=8080"),
element(name("value"), "alfresco.port=" + getPort())
),
element(name("replacement"),
element(name("token"), "alfresco.secureComms=https"),
element(name("value"), "alfresco.secureComms=none")
)
)
),
execEnv
);
}
/**
* If we are in Alfresco version 4.2 or younger the Solr 1.0 WAR is not available as Maven artifact, just
* as part of a ZIP file, so install it locally so we can deploy from embedded tomcat
*
* @throws MojoExecutionException
*/
protected void installSolr10InLocalRepo() throws MojoExecutionException {
if (isPlatformVersionLtOrEqTo42()) {
getLog().info("Installing Solr 1.0 WAR in local Maven repo");
File solrWarSource = new File( solrHome + "/apache-solr-1.4.1.war" );
File outputDir = new File( project.getBuild().getDirectory() + "/solr");
if (outputDir.exists()) {
getLog().info("Solr build dir: "+ outputDir +" already exists, not rebuilding");
return;
}
ZipUtil.unpack( solrWarSource, outputDir );
// Comment out SSL/security requirements
executeMojo(
plugin(
groupId("com.google.code.maven-replacer-plugin"),
artifactId("replacer"),
version(MAVEN_REPLACER_PLUGIN_VERSION)
),
goal("replace"),
configuration(
element(name("regex"), "false"),
element(name("includes"),
element(name("include"), outputDir + "/WEB-INF/web.xml")
),
element(name("replacements"),
element(name("replacement"),
element(name("token"), "<!-- <security-constraint>"),
element(name("value"), "<security-constraint>")
),
element(name("replacement"),
element(name("token"), "</security-role> -->"),
element(name("value"), "</security-role>")
),
element(name("replacement"),
element(name("token"), "<security-constraint>"),
element(name("value"), "<!-- <security-constraint>")
),
element(name("replacement"),
element(name("token"), "</security-role>"),
element(name("value"), "</security-role> -->")
)
)
),
execEnv
);
executeMojo(
plugin(
groupId("com.coderplus.maven.plugins"),
artifactId("copy-rename-maven-plugin"),
version("1.0")
),
goal("copy"),
configuration(
element(name("sourceFile"), solrHome + "/log4j-solr.properties"),
element(name("destinationFile"), outputDir + "/WEB-INF/classes/log4j.properties")
),
execEnv
);
executeMojo(
plugin(
groupId("org.apache.maven.plugins"),
artifactId("maven-resources-plugin"),
version(MAVEN_RESOURCE_PLUGIN_VERSION)
),
goal("copy-resources"),
configuration(
element(name("outputDirectory"), outputDir + "/WEB-INF/lib"),
element(name("resources"),
element(name("resource"),
element(name("directory"), solrHome + "/lib"),
element(name("includes"),
element(name("include"), "*org.springframework*")
),
element(name("filtering"), "false")
)
)
),
execEnv
);
ZipUtil.pack(outputDir, new File(solrHome + "/apache-solr-1.4.1.war"));
// Install the Solr 1.0 war file in local maven repo
executeMojo(
plugin(
groupId("org.apache.maven.plugins"),
artifactId("maven-install-plugin"),
version(MAVEN_INSTALL_PLUGIN_VERSION)
),
goal("install-file"),
configuration(
element(name("file"), solrHome + "/apache-solr-1.4.1.war"),
element(name("groupId"), "${project.groupId}"),
element(name("artifactId"), getSolrArtifactId()),
element(name("version"), "${project.version}"),
element(name("packaging"), "war")
)
, execEnv
);
}
}
/**
* Replaces web.xml where applicable in platform webapp (alfresco.war),
* commenting out the security-constraints.
* <p/>
* This is only needed for 4.2, 5.0 (5.1 handles it automatically when turning off ssl via props)
*
* @throws MojoExecutionException
*/
protected void commentOutSecureCommsInPlatformWebXml() throws MojoExecutionException {
if (isPlatformVersionGtOrEqTo51()) {
return;
}
String webInfPath = getWarOutputDir(PLATFORM_WAR_PREFIX_NAME) + "/WEB-INF/";
String webXmlFilePath = webInfPath + "web.xml";
getLog().info("Commenting out the security-constraints in " + webXmlFilePath);
executeMojo(
plugin(
groupId("com.google.code.maven-replacer-plugin"),
artifactId("replacer"),
version(MAVEN_REPLACER_PLUGIN_VERSION)
),
goal("replace"),
configuration(
element(name("ignoreErrors"), "true"),
element(name("file"), webXmlFilePath),
element(name("outputDir"), webInfPath),
element(name("preserveDir"), "false"),
element(name("replacements"),
element(name("replacement"),
element(name("token"), "<!-- Toggle securecomms placeholder start -->"),
element(name("value"), "<!-- ")
),
element(name("replacement"),
element(name("token"), "<!-- Toggle securecomms placeholder end -->"),
element(name("value"), " -->")
)
)
),
execEnv
);
}
/**
* Copy the different alfresco-global-*.properties files (there are one for each open source db and one for
* enterprise db config) that will be used when running Alfresco. It contains database connection parameters and
* Copy the alfresco-global.properties files. It contains database connection parameters and
* other general configuration for Alfresco Repository (alfresco.war)
*
* @throws MojoExecutionException
*/
protected void copyAlfrescoGlobalProperties() throws MojoExecutionException {
getLog().info("Copying and filtering alfresco-global-*.properties files to target/test-classes");
getLog().info("Copying and filtering alfresco-global.properties files to target/test-classes");
executeMojo(
plugin(
groupId("org.apache.maven.plugins"),
@ -709,36 +366,6 @@ public abstract class AbstractRunMojo extends AbstractMojo {
execEnv
);
if (isPlatformVersionLtOrEqTo42() && enableSolr) {
getLog().info("Platform is 4.2 and Solr is enabled, setting 'index.subsystem.name=solr' in alfresco-global.properties");
executeMojo(
plugin(
groupId("com.google.code.maven-replacer-plugin"),
artifactId("replacer"),
version(MAVEN_REPLACER_PLUGIN_VERSION)
),
goal("replace"),
configuration(
element(name("regex"), "false"),
element(name("includes"),
element(name("include"), "${project.build.testOutputDirectory}/*.properties")
),
element(name("replacements"),
element(name("replacement"),
element(name("token"), "index.subsystem.name=solr4"),
element(name("value"), "index.subsystem.name=solr")
),
element(name("replacement"),
element(name("token"), "index.subsystem.name=lucene"),
element(name("value"), "index.subsystem.name=solr")
)
)
),
execEnv
);
}
}
@ -750,10 +377,6 @@ public abstract class AbstractRunMojo extends AbstractMojo {
* @throws MojoExecutionException
*/
protected void copyAlfrescoLicense() throws MojoExecutionException {
if (alfrescoEdition.equals(ALFRESCO_COMMUNITY_EDITION)) {
getLog().info("NOT copying Alfresco Enterprise license, running Community edition");
return;
}
final String warOutputDir = getWarOutputDir(PLATFORM_WAR_PREFIX_NAME);
final String licDestDir = warOutputDir + "/WEB-INF/classes/alfresco/extension/license";
@ -906,9 +529,8 @@ public abstract class AbstractRunMojo extends AbstractMojo {
*/
protected void buildPlatformWar() throws MojoExecutionException {
buildCustomWarInDir(PLATFORM_WAR_PREFIX_NAME, platformModules,
alfrescoGroupId, getPlatformWarArtifactId(), alfrescoPlatformVersion);
alfrescoGroupId, alfrescoPlatformWarArtifactId, alfrescoPlatformVersion);
commentOutSecureCommsInPlatformWebXml();
copyAlfrescoLicense();
copyHotswapAgentProperties(PLATFORM_WAR_PREFIX_NAME);
@ -1112,32 +734,6 @@ public abstract class AbstractRunMojo extends AbstractMojo {
return warArtifactId;
}
/**
* Check that a database configuration has been supplied correctly
*/
protected void checkDatabaseConfig() throws MojoExecutionException {
// Only do this check if we are running alfresco.war that needs a database.
if (enablePlatform) {
if (enableH2 && !enableMySQL && !enablePostgreSQL) {
// Run with the H2 database
return;
} else if (!enableH2 && enableMySQL && !enablePostgreSQL) {
// Run with the MySQL database
return;
} else if (!enableH2 && !enableMySQL && enablePostgreSQL) {
// Run with the PostgreSQL database
return;
} else if (!enableH2 && !enableMySQL && !enablePostgreSQL) {
// Run with a database configured via Tomcat Dependencies
return;
} else {
throw new MojoExecutionException(
"Invalid database configuration, " +
"should be enableH2 or enableMySQL or enablePostgreSQL " +
"or none (i.e. config via Tomcat Dependencies)");
}
}
}
/**
* Start up the embedded Tomcat server with the webapps that has been
@ -1172,24 +768,14 @@ public abstract class AbstractRunMojo extends AbstractMojo {
}
}
if (enableH2) {
tomcatPluginDependencies.add(
// Bring in the flat file H2 database
dependency("com.h2database", "h2", "1.4.190"));
tomcatPluginDependencies.add(
// Bring in the MySQL JDBC Driver
dependency("mysql", "mysql-connector-java", "5.1.32"));
tomcatPluginDependencies.add(
// Bring in the PostgreSQL JDBC Driver
dependency("org.postgresql", "postgresql", "9.4-1201-jdbc41"));
if (enablePlatform) {
// Copy the h2 scripts for the Alfresco Repository database
copyH2Dialect();
}
} else if (enableMySQL) {
tomcatPluginDependencies.add(
// Bring in the MySQL JDBC Driver
dependency("mysql", "mysql-connector-java", "5.1.32"));
} else if (enablePostgreSQL) {
tomcatPluginDependencies.add(
// Bring in the PostgreSQL JDBC Driver
dependency("org.postgresql", "postgresql", "9.4-1201-jdbc41"));
}
if (enablePlatform) {
webapps2Deploy.add(createWebAppElement(
@ -1203,10 +789,6 @@ public abstract class AbstractRunMojo extends AbstractMojo {
shareContextPath, null));
}
if (enableSolr) {
webapps2Deploy.add(getSolrWebappElement());
}
if (enableApiExplorer) {
webapps2Deploy.add(createWebAppElement(
alfrescoGroupId, alfrescoApiExplorerArtifactId, alfrescoApiExplorerVersion,
@ -1230,9 +812,7 @@ public abstract class AbstractRunMojo extends AbstractMojo {
// Set up the system properties that should be set for Tomcat
ArrayList systemProps = new ArrayList<Element>();
if (enableSolr) {
systemProps.add(element(name("solr.solr.home"), solrHome + "/"));
}
// Add custom system properties defined in plugin config
if (tomcatSystemProperties != null && !tomcatSystemProperties.isEmpty()) {
for (Map.Entry<String, String> sysProp : tomcatSystemProperties.entrySet()) {
@ -1290,9 +870,6 @@ public abstract class AbstractRunMojo extends AbstractMojo {
element(name("useTestClasspath"), "true"),
/**
* Set up where Solr Home directory is
*/
element(name("systemProperties"), systemPropArray),
/* Should this class loader delegate to the parent class loader before searching its
@ -1422,186 +999,7 @@ public abstract class AbstractRunMojo extends AbstractMojo {
return Integer.parseInt(alfrescoPlatformVersion.replaceAll("[^0-9]", "").substring(0, 2));
}
/**
* Get the Solr artifactId, it changes when we move to Solr 4 in Alfresco version 5
*
* @return the Maven artifactId for Solr
*/
private String getSolrArtifactId() {
// artifactId for Solr defaults to version 4 = alfresco-solr4
if (isPlatformVersionLtOrEqTo42()) {
// Solr version 1 is used in Alfresco 4.0 -> 4.2, Solr version 4.0 was introduced in Alfresco version 5.0
alfrescoSolrArtifactId = "alfresco-solr";
}
return alfrescoSolrArtifactId;
}
/**
* Get the Alfresco Platform Webapp artifactId (i.e. for alfresco.war),
* it changes from 'alfresco' to 'alfresco-platform' in 5.1.
*
* Matrix for determining the Alfresco WAR Artifact
* 4.2.x Community == alfresco.war
* 4.2.x Enterprise == alfresco.war
* 5.0.x Community == alfresco.war
* 5.0.x Enterprise == alfresco-enterprise.war
* 5.1.x Community == alfresco-platform.war
* 5.1.x Enterprise == alfresco-platform-enterprise.war
*
* @return the Maven artifactId for Alfresco Platform webapp
*/
private String getPlatformWarArtifactId() {
if (isPlatformVersionGtOrEqTo51() == false && alfrescoEdition.equals(ALFRESCO_COMMUNITY_EDITION)) {
// We are running version 4.2 or 5.0 in community so use "alfresco"
alfrescoPlatformWarArtifactId = "alfresco";
}
if (isPlatformVersionLtOrEqTo42() == true && alfrescoEdition.equals(ALFRESCO_ENTERPRISE_EDITION)) {
// We are running version 4.2 so use "alfresco-enterprise"
alfrescoPlatformWarArtifactId = "alfresco";
}
if (getPlatformVersionNumber() == 50 && alfrescoEdition.equals(ALFRESCO_ENTERPRISE_EDITION)) {
// We are running version 5.0 in enterprise so use "alfresco-enterprise"
alfrescoPlatformWarArtifactId = "alfresco-enterprise";
}
if (isPlatformVersionGtOrEqTo51() == true && alfrescoEdition.equals(ALFRESCO_COMMUNITY_EDITION)) {
// We are running version 5.1 or greater in community so use "alfresco-platform"
alfrescoPlatformWarArtifactId = "alfresco-platform";
}
if (isPlatformVersionGtOrEqTo51() == true && alfrescoEdition.equals(ALFRESCO_ENTERPRISE_EDITION)) {
// We are running version 5.1 or greater in enterprise so use "alfresco-platform-enterprise"
alfrescoPlatformWarArtifactId = "alfresco-platform-enterprise";
}
return alfrescoPlatformWarArtifactId;
}
/**
* Get the Solr webapp element for use by Tomcat, it changes when we move to Solr 4 in Alfresco version 5
*
* @return tomcat webapp element
*/
private Element getSolrWebappElement() {
Element webappElement = null;
if (isPlatformVersionLtOrEqTo42()) {
// Solr version 1.0
webappElement = createWebAppElement("${project.groupId}", getSolrArtifactId(), "${project.version}",
"/solr", "${project.build.testOutputDirectory}/tomcat/context-solr.xml");
} else {
// Solr version 4.0
webappElement = createWebAppElement(alfrescoGroupId, getSolrArtifactId(), alfrescoPlatformVersion,
"/solr4", "${project.build.testOutputDirectory}/tomcat/context-solr.xml");
}
return webappElement;
}
/**
* TODO: From 5.1.e and onwards we have the alfresco-repository:h2scripts:jar artifact, so we potentially only need to do this for older than 5.1.e
*
*
* Extract PostgreSQL dialect and ibatis from alfresco-repository, rename to H2Dialect in the test-classes
*
* @return
*/
private void copyH2Dialect() throws MojoExecutionException {
String h2SourceDir;
if ( ! isPlatformVersionLtOrEqTo42()) {
getLog().info("Unpacking DB Dialects and ibatis files from alfresco-repository artifact");
executeMojo(
plugin(
groupId("org.apache.maven.plugins"),
artifactId("maven-dependency-plugin"),
version(MAVEN_DEPENDENCY_PLUGIN_VERSION)
),
goal("unpack"),
configuration(
element(name("outputDirectory"), "${project.build.testOutputDirectory}"),
element(name("artifactItems"),
element(name("artifactItem"),
element(name("groupId"), alfrescoGroupId),
element(name("artifactId"), "alfresco-repository"),
element(name("version"), alfrescoPlatformVersion),
element(name("includes"), "alfresco/dbscripts/create/org.hibernate.dialect.PostgreSQLDialect/*,alfresco/dbscripts/upgrade/*/org.hibernate.dialect.PostgreSQLDialect/*,alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/*")
)
)
),
execEnv
);
// If we're in enterprise we need to make sure we grab everything
if (this.alfrescoEdition.equals(ALFRESCO_ENTERPRISE_EDITION)) {
executeMojo(
plugin(
groupId("org.apache.maven.plugins"),
artifactId("maven-dependency-plugin"),
version(MAVEN_DEPENDENCY_PLUGIN_VERSION)
),
goal("unpack"),
configuration(
element(name("outputDirectory"), "${project.build.testOutputDirectory}"),
element(name("artifactItems"),
element(name("artifactItem"),
element(name("groupId"), alfrescoGroupId),
element(name("artifactId"), "alfresco-enterprise-repository"),
element(name("version"), alfrescoPlatformVersion),
element(name("includes"), "alfresco/dbscripts/create/org.hibernate.dialect.PostgreSQLDialect/*,alfresco/dbscripts/upgrade/*/org.hibernate.dialect.PostgreSQLDialect/*,alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect/*")
)
)
),
execEnv
);
}
h2SourceDir = project.getBuild().getTestOutputDirectory();
} else {
// 4.2 has the dbscript directly in the exploded WAR file so we simply grab them there
h2SourceDir = getWarOutputDir(PLATFORM_WAR_PREFIX_NAME) + "/WEB-INF/classes";
}
getLog().info("Copying H2 Dialect SQL create files into target/test-classes");
executeMojo(
plugin(
groupId("org.apache.maven.plugins"),
artifactId("maven-resources-plugin"),
version(MAVEN_RESOURCE_PLUGIN_VERSION)
),
goal("copy-resources"),
configuration(
element(name("outputDirectory"), "${project.build.testOutputDirectory}"),
element(name("resources"),
element(name("resource"),
element(name("directory"), h2SourceDir + "/alfresco/dbscripts/create/org.hibernate.dialect.PostgreSQLDialect"),
element(name("includes"),
element(name("include"), "*")
),
element(name("targetPath"), "alfresco/dbscripts/create/org.hibernate.dialect.H2Dialect")
),
element(name("resource"),
element(name("directory"), h2SourceDir + "/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect"),
element(name("includes"),
element(name("include"), "*")
),
element(name("targetPath"), "alfresco/ibatis/org.hibernate.dialect.H2Dialect")
)
)
),
execEnv
);
}
/**

View File

@ -82,18 +82,12 @@ public class IntegrationTestMojo extends AbstractRunMojo {
getLog().info("Checking if Tomcat is already running on port " + "");
if ( ! tomcatIsRunning() ) {
if (enableSolr) {
unpackSolrConfig();
fixSolrHomePath();
replaceSolrConfigProperties();
installSolr10InLocalRepo();
}
if (enableTestProperties && enablePlatform) {
copyAlfrescoGlobalProperties();
}
String testJarArtifactId = null;
if (enablePlatform) {
// Add alfresco-rad module to platform WAR
// So we got access to Alfresco Test Runner in the server

View File

@ -47,15 +47,6 @@ public class RunMojo extends AbstractRunMojo {
);
if (enableSolr) {
unpackSolrConfig();
fixSolrHomePath();
copySolrCustomConfig();
replaceSolrConfigProperties();
installSolr10InLocalRepo();
}
if (enableTestProperties && enablePlatform) {
copyAlfrescoGlobalProperties();
}
@ -69,7 +60,6 @@ public class RunMojo extends AbstractRunMojo {
}
if (startTomcat) {
checkDatabaseConfig();
boolean fork = false;
startTomcat(fork);
}