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.model.dir>${solr.home}/alfrescoModels</solr.model.dir>
<solr.content.dir>${solr.home}/index</solr.content.dir> <solr.content.dir>${solr.home}/index</solr.content.dir>
<!-- Alfresco webapp artifacts and versions, these are the original Alfresco webapps that will be <!-- Properties used in dependency declarations, you don't need to change these -->
customized and then deployed and run by the tomcat maven plugin when
executing for example $ mvn clean install alfresco:run -->
<alfresco.groupId>org.alfresco</alfresco.groupId> <alfresco.groupId>org.alfresco</alfresco.groupId>
<alfresco.platform.war.artifactId>alfresco-platform</alfresco.platform.war.artifactId> <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.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.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.surf.version>6.5</alfresco.surf.version>
<!-- Alfresco Repo Database configuration. <!-- Alfresco Repo Database configuration.
@ -70,7 +73,7 @@
but alfresco version can/should be overridden in your project's pom but alfresco version can/should be overridden in your project's pom
--> -->
<dependency> <dependency>
<groupId>org.alfresco</groupId> <groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-platform-distribution</artifactId> <artifactId>alfresco-platform-distribution</artifactId>
<version>${alfresco.platform.version}</version> <version>${alfresco.platform.version}</version>
<type>pom</type> <type>pom</type>

View File

@ -27,13 +27,14 @@
<solr.model.dir>${solr.home}/alfrescoModels</solr.model.dir> <solr.model.dir>${solr.home}/alfrescoModels</solr.model.dir>
<solr.content.dir>${solr.home}/index</solr.content.dir> <solr.content.dir>${solr.home}/index</solr.content.dir>
<!-- Alfresco webapp artifacts and versions, these are the original Alfresco webapps that will be <!-- Properties used in dependency declarations, you don't need to change these -->
<alfresco.groupId>org.alfresco</alfresco.groupId>
<!-- 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 customized and then deployed and run by the tomcat maven plugin when
executing for example $ mvn clean install alfresco:run --> executing for example $ mvn clean install alfresco:run -->
<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.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.share.version>5.1.g</alfresco.share.version>
<!-- Alfresco Repo Database configuration. <!-- Alfresco Repo Database configuration.
@ -68,7 +69,7 @@
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.alfresco</groupId> <groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-platform-distribution</artifactId> <artifactId>alfresco-platform-distribution</artifactId>
<version>${alfresco.platform.version}</version> <version>${alfresco.platform.version}</version>
<type>pom</type> <type>pom</type>

View File

@ -14,11 +14,16 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Alfresco webapp artifacts and versions, these are the webapps that will be deployed <!-- Properties used in dependency declarations, you don't need to change these -->
and run by the tomcat maven plugin when executing $ mvn .... alfresco:run -->
<alfresco.groupId>org.alfresco</alfresco.groupId> <alfresco.groupId>org.alfresco</alfresco.groupId>
<alfresco.share.war.artifactId>share</alfresco.share.war.artifactId> <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.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.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. <!-- 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 { protected void buildPlatformWar() throws MojoExecutionException {
buildCustomWarInDir(PLATFORM_WAR_PREFIX_NAME, platformModules, buildCustomWarInDir(PLATFORM_WAR_PREFIX_NAME, platformModules,
alfrescoPlatformWarArtifactId, alfrescoPlatformVersion); getPlatformWarArtifactId(), alfrescoPlatformVersion);
commentOutSecureCommsInPlatformWebXml(); commentOutSecureCommsInPlatformWebXml();
@ -869,6 +869,23 @@ public class RunMojo extends AbstractMojo {
return false; 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 * 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; 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 * 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 the H2 database scripts dependency, so Tomcat knows where to grab them.
* *
* @return * @return dependency for H2 database scripts
*/ */
private Dependency getH2ScriptsDependency() { private Dependency getH2ScriptsDependency() {
Dependency h2ScriptsDependency = null; Dependency h2ScriptsDependency = null;
if (isPlatformVersionLtOrEqTo42()) { if (isPlatformVersionLtOrEqTo42() || isPlatformVersion50bOr50c()) {
// The alfresco-repository H2 Scripts artifact is not available until version 5.0 of Alfresco, // 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 // 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 // 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 // See https://github.com/skuro/alfresco-h2-support/wiki/H2-Database-support-for-Alfresco
if (isPlatformVersion50bOr50c()) {
h2ScriptsDependency = dependency("tk.skuro.alfresco", "h2-support", "5.0");
} else {
h2ScriptsDependency = dependency("tk.skuro.alfresco", "h2-support", "1.5"); h2ScriptsDependency = dependency("tk.skuro.alfresco", "h2-support", "1.5");
}
} else { } else {
h2ScriptsDependency = dependency(alfrescoGroupId, "alfresco-repository", alfrescoPlatformVersion); h2ScriptsDependency = dependency(alfrescoGroupId, "alfresco-repository", alfrescoPlatformVersion);
h2ScriptsDependency.setClassifier("h2scripts"); h2ScriptsDependency.setClassifier("h2scripts");