Fix h2 scripts for 5.0.[b|c], handle alfresco-platform or alfresco, clarify props docs

This commit is contained in:
Martin Bergljung 2016-08-18 13:49:41 +01:00
parent 07c06a2bbd
commit e997a33fc9
4 changed files with 69 additions and 19 deletions

View File

@ -27,15 +27,18 @@
<solr.model.dir>${solr.home}/alfrescoModels</solr.model.dir>
<solr.content.dir>${solr.home}/index</solr.content.dir>
<!-- Alfresco webapp artifacts and versions, these are the original Alfresco webapps that will be
customized and then deployed and run by the tomcat maven plugin when
executing for example $ mvn clean install alfresco:run -->
<!-- Properties used in dependency declarations, you don't need to change these -->
<alfresco.groupId>org.alfresco</alfresco.groupId>
<alfresco.platform.war.artifactId>alfresco-platform</alfresco.platform.war.artifactId>
<!--4.2, 5.0, 5.1 artifact ID: <alfresco.platform.war.artifactId>alfresco</alfresco.platform.war.artifactId>-->
<alfresco.platform.version>5.2.a-EA</alfresco.platform.version>
<alfresco.share.war.artifactId>share</alfresco.share.war.artifactId>
<!-- Alfresco Platform and Share webapp versions, these are the original Alfresco webapps that will be
customized and then deployed and run by the tomcat maven plugin when
executing for example $ mvn clean install alfresco:run -->
<alfresco.platform.version>5.2.a-EA</alfresco.platform.version>
<alfresco.share.version>5.1.g</alfresco.share.version>
<!-- Alfresco Surf version, if you change Share version you might need to change Surf version -->
<alfresco.surf.version>6.5</alfresco.surf.version>
<!-- Alfresco Repo Database configuration.
@ -70,7 +73,7 @@
but alfresco version can/should be overridden in your project's pom
-->
<dependency>
<groupId>org.alfresco</groupId>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-platform-distribution</artifactId>
<version>${alfresco.platform.version}</version>
<type>pom</type>

View File

@ -27,13 +27,14 @@
<solr.model.dir>${solr.home}/alfrescoModels</solr.model.dir>
<solr.content.dir>${solr.home}/index</solr.content.dir>
<!-- Alfresco webapp artifacts and versions, these are the original Alfresco webapps that will be
customized and then deployed and run by the tomcat maven plugin when
executing for example $ mvn clean install alfresco:run -->
<!-- Properties used in dependency declarations, you don't need to change these -->
<alfresco.groupId>org.alfresco</alfresco.groupId>
<alfresco.platform.war.artifactId>alfresco-platform</alfresco.platform.war.artifactId>
<!--4.2, 5.0, 5.1 artifact ID: <alfresco.platform.war.artifactId>alfresco</alfresco.platform.war.artifactId>-->
<!-- Alfresco Platform webapp version, this is the original Alfresco webapp that will be
customized and then deployed and run by the tomcat maven plugin when
executing for example $ mvn clean install alfresco:run -->
<alfresco.platform.version>5.2.a-EA</alfresco.platform.version>
<!-- Alfresco Share version, so we can bring in correct alfresco-share-services artifact -->
<alfresco.share.version>5.1.g</alfresco.share.version>
<!-- Alfresco Repo Database configuration.
@ -68,7 +69,7 @@
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.alfresco</groupId>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-platform-distribution</artifactId>
<version>${alfresco.platform.version}</version>
<type>pom</type>

View File

@ -14,11 +14,16 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Alfresco webapp artifacts and versions, these are the webapps that will be deployed
and run by the tomcat maven plugin when executing $ mvn .... alfresco:run -->
<!-- Properties used in dependency declarations, you don't need to change these -->
<alfresco.groupId>org.alfresco</alfresco.groupId>
<alfresco.share.war.artifactId>share</alfresco.share.war.artifactId>
<!-- Alfresco Share webapp version, this is the original Alfresco webapp that will be
customized and then deployed and run by the tomcat maven plugin when
executing for example $ mvn clean install alfresco:run -->
<alfresco.share.version>5.1.g</alfresco.share.version>
<!-- Alfresco Surf version, if you change Share version you might need to change Surf version -->
<alfresco.surf.version>6.5</alfresco.surf.version>
<!-- Since alfresco.war (i.e. the Platform/Repository) is already running on port 8080, we run Share.WAR on port 8081.

View File

@ -430,7 +430,7 @@ public class RunMojo extends AbstractMojo {
*/
protected void buildPlatformWar() throws MojoExecutionException {
buildCustomWarInDir(PLATFORM_WAR_PREFIX_NAME, platformModules,
alfrescoPlatformWarArtifactId, alfrescoPlatformVersion);
getPlatformWarArtifactId(), alfrescoPlatformVersion);
commentOutSecureCommsInPlatformWebXml();
@ -869,6 +869,23 @@ public class RunMojo extends AbstractMojo {
return false;
}
/**
* TODO: Remove when we got h2-scripts in alfresco-repository for all artifacts
*
* Returns true if current platform version (i.e. version of alfresco.war) is
* 5.0.b or 5.0.c (h2-scripts appears first in 5.0.d)
*
* @return true if platform version is 5.0.b or 5.0.c
*/
private boolean isPlatformVersion50bOr50c() {
if (StringUtils.equalsIgnoreCase(alfrescoPlatformVersion, "5.0.b") ||
StringUtils.equalsIgnoreCase(alfrescoPlatformVersion, "5.0.c")) {
return true;
}
return false;
}
/**
* Get the Solr artifactId, it changes when we move to Solr 4 in Alfresco version 5
*
@ -885,6 +902,23 @@ public class RunMojo extends AbstractMojo {
return alfrescoSolrArtifactId;
}
/**
* Get the Alfresco Platform Webapp artifactId (i.e. for alfresco.war),
* it changes from 'alfresco' to 'alfresco-platform' in 5.1.
*
* @return the Maven artifactId for Alfresco Platform webapp
*/
private String getPlatformWarArtifactId() {
// Default alfrescoPlatformWarArtifactId is 'alfresco-platform'
if (isPlatformVersionGtOrEqTo51() == false) {
// We are running version 4.2 or 5.0, so use older artifactId
alfrescoPlatformWarArtifactId = "alfresco";
}
return alfrescoPlatformWarArtifactId;
}
/**
* Get the Solr webapp element for use by Tomcat, it changes when we move to Solr 4 in Alfresco version 5
*
@ -907,19 +941,26 @@ public class RunMojo extends AbstractMojo {
}
/**
* TODO: Remove when we got h2-scripts in alfresco-repository for all artifacts
*
* Return the H2 database scripts dependency, so Tomcat knows where to grab them.
*
* @return
* @return dependency for H2 database scripts
*/
private Dependency getH2ScriptsDependency() {
Dependency h2ScriptsDependency = null;
if (isPlatformVersionLtOrEqTo42()) {
// The alfresco-repository H2 Scripts artifact is not available until version 5.0 of Alfresco,
if (isPlatformVersionLtOrEqTo42() || isPlatformVersion50bOr50c()) {
// The alfresco-repository H2 Scripts artifact is not available until version 5.0.d of Alfresco,
// have to grab it from a community project called h2-support instead, this artifact is used by
// previous versions of the SDK, version 1.5 is for Alfresco 4.2 community
// See https://github.com/skuro/alfresco-h2-support/wiki/H2-Database-support-for-Alfresco
h2ScriptsDependency = dependency("tk.skuro.alfresco", "h2-support", "1.5");
if (isPlatformVersion50bOr50c()) {
h2ScriptsDependency = dependency("tk.skuro.alfresco", "h2-support", "5.0");
} else {
h2ScriptsDependency = dependency("tk.skuro.alfresco", "h2-support", "1.5");
}
} else {
h2ScriptsDependency = dependency(alfrescoGroupId, "alfresco-repository", alfrescoPlatformVersion);
h2ScriptsDependency.setClassifier("h2scripts");