mirror of
https://github.com/Alfresco/alfresco-sdk.git
synced 2025-07-31 17:39:14 +00:00
Bring back h2 support by copying them manually. Even though we have h2scripts from 5.1.e we don't have it for the older releases
This commit is contained in:
@@ -165,6 +165,12 @@ public class RunMojo extends AbstractMojo {
|
|||||||
@Parameter(property = "maven.alfresco.share.modules", defaultValue = "")
|
@Parameter(property = "maven.alfresco.share.modules", defaultValue = "")
|
||||||
protected List<ModuleDependency> shareModules;
|
protected List<ModuleDependency> shareModules;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Community Edition or Enterprise Edition? (i.e community or enterprise)
|
||||||
|
*/
|
||||||
|
@Parameter(property = "maven.alfresco.edition", defaultValue = "community")
|
||||||
|
protected String alfrescoEdition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maven GAV properties for standard Alfresco web applications.
|
* Maven GAV properties for standard Alfresco web applications.
|
||||||
*/
|
*/
|
||||||
@@ -678,9 +684,10 @@ public class RunMojo extends AbstractMojo {
|
|||||||
tomcatDependencies.add(
|
tomcatDependencies.add(
|
||||||
// Bring in the flat file H2 database
|
// Bring in the flat file H2 database
|
||||||
dependency("com.h2database", "h2", "1.4.190"));
|
dependency("com.h2database", "h2", "1.4.190"));
|
||||||
tomcatDependencies.add(
|
|
||||||
// Bring in the H2 Database scripts for the Alfresco version we use
|
// Copy the h2 scripts
|
||||||
getH2ScriptsDependency());
|
copyH2Dialect();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enablePlatform) {
|
if (enablePlatform) {
|
||||||
@@ -941,34 +948,93 @@ public class RunMojo extends AbstractMojo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Remove when we got h2-scripts in alfresco-repository for all artifacts
|
* 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
|
||||||
*
|
*
|
||||||
* Return the H2 database scripts dependency, so Tomcat knows where to grab them.
|
|
||||||
*
|
*
|
||||||
* @return dependency for H2 database scripts
|
* Extract PostgreSQL dialect and ibatis from alfresco-repository, rename to H2Dialect in the test-classes
|
||||||
|
*
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
private Dependency getH2ScriptsDependency() {
|
private void copyH2Dialect() throws MojoExecutionException {
|
||||||
Dependency h2ScriptsDependency = null;
|
getLog().info("Unpacking DB Dialects and ibatis");
|
||||||
|
executeMojo(
|
||||||
|
plugin(
|
||||||
|
groupId("org.apache.maven.plugins"),
|
||||||
|
artifactId("maven-dependency-plugin"),
|
||||||
|
version("2.9")
|
||||||
|
),
|
||||||
|
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 (isPlatformVersionLtOrEqTo42() || isPlatformVersion50bOr50c()) {
|
// If we're in enterprise we need to make sure we grab everything
|
||||||
// The alfresco-repository H2 Scripts artifact is not available until version 5.0.d of Alfresco,
|
if (this.alfrescoEdition.equals( "enterprise" )) {
|
||||||
// have to grab it from a community project called h2-support instead, this artifact is used by
|
executeMojo(
|
||||||
// previous versions of the SDK, version 1.5 is for Alfresco 4.2 community
|
plugin(
|
||||||
// See https://github.com/skuro/alfresco-h2-support/wiki/H2-Database-support-for-Alfresco
|
groupId("org.apache.maven.plugins"),
|
||||||
|
artifactId("maven-dependency-plugin"),
|
||||||
if (isPlatformVersion50bOr50c()) {
|
version("2.9")
|
||||||
h2ScriptsDependency = dependency("tk.skuro.alfresco", "h2-support", "5.0");
|
),
|
||||||
} else {
|
goal("unpack"),
|
||||||
h2ScriptsDependency = dependency("tk.skuro.alfresco", "h2-support", "1.5");
|
configuration(
|
||||||
}
|
element(name("outputDirectory"), "${project.build.testOutputDirectory}"),
|
||||||
} else {
|
element(name("artifactItems"),
|
||||||
h2ScriptsDependency = dependency(alfrescoGroupId, "alfresco-repository", alfrescoPlatformVersion);
|
element(name("artifactItem"),
|
||||||
h2ScriptsDependency.setClassifier("h2scripts");
|
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
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return h2ScriptsDependency;
|
getLog().info("Extracting H2 Dialect");
|
||||||
|
executeMojo(
|
||||||
|
plugin(
|
||||||
|
groupId("org.apache.maven.plugins"),
|
||||||
|
artifactId("maven-resources-plugin"),
|
||||||
|
version("2.7")
|
||||||
|
),
|
||||||
|
goal("copy-resources"),
|
||||||
|
configuration(
|
||||||
|
element(name("outputDirectory"), "${project.build.testOutputDirectory}"),
|
||||||
|
element(name("resources"),
|
||||||
|
element(name("resource"),
|
||||||
|
element(name("directory"), "${project.build.testOutputDirectory}/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"), "${project.build.testOutputDirectory}/alfresco/ibatis/org.hibernate.dialect.PostgreSQLDialect"),
|
||||||
|
element(name("includes"),
|
||||||
|
element(name("include"), "*")
|
||||||
|
),
|
||||||
|
element(name("targetPath"), "alfresco/ibatis/org.hibernate.dialect.H2Dialect")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
execEnv
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The directory where the custom war will be assembled
|
* The directory where the custom war will be assembled
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user