mirror of
https://github.com/Alfresco/alfresco-sdk.git
synced 2025-10-08 14:51:55 +00:00
Merge branch 'bug/sdk-3-bugfixing' into solr-cron
This commit is contained in:
31
README.md
31
README.md
@@ -3,11 +3,12 @@
|
|||||||
This is the home of the Alfresco SDK. The Alfresco SDK is used by developers to build extensions for the Alfresco Digital Business Platform. It is based on [Apache Maven](http://maven.apache.org/), compatible with major IDEs and enables Rapid Application Development (RAD) and Test Driven Development (TDD).
|
This is the home of the Alfresco SDK. The Alfresco SDK is used by developers to build extensions for the Alfresco Digital Business Platform. It is based on [Apache Maven](http://maven.apache.org/), compatible with major IDEs and enables Rapid Application Development (RAD) and Test Driven Development (TDD).
|
||||||
|
|
||||||
## License
|
## License
|
||||||
This project is released under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). If you are an Enterprise customer check the [Support](#alfresco-enterprise-customers-and-partners-support) section.
|
This project is released under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html) license.
|
||||||
|
If you are an Enterprise customer check the [Support](#alfresco-enterprise-customers-and-partners-support) section.
|
||||||
|
|
||||||
## News
|
## News
|
||||||
|
|
||||||
- 2017-06-23: Alfresco SDK 3.0.1 released, [containing a critial bugfix](https://github.com/Alfresco/alfresco-sdk/issues/461)
|
- 2017-06-23: Alfresco SDK 3.0.1 released, [containing a critical bugfix](https://github.com/Alfresco/alfresco-sdk/issues/461)
|
||||||
- 2017-04-01: Alfresco SDK 3.0.0 released
|
- 2017-04-01: Alfresco SDK 3.0.0 released
|
||||||
- 2017-03-27: After years of hard work, countless iterations and gathering feedback, SDK 3.0 has finally been merged into the master branch, ready for release in the coming days
|
- 2017-03-27: After years of hard work, countless iterations and gathering feedback, SDK 3.0 has finally been merged into the master branch, ready for release in the coming days
|
||||||
- 2016-02-20: SDK 2.2.0 released to Maven Central. Docs for [Community](http://docs.alfresco.com/community/concepts/alfresco-sdk-intro.html), [Enterprise](http://docs.alfresco.com/5.1/concepts/alfresco-sdk-intro.html), [Release notes](https://artifacts.alfresco.com/nexus/content/repositories/alfresco-docs/alfresco-sdk-aggregator/latest/github-report.html)
|
- 2016-02-20: SDK 2.2.0 released to Maven Central. Docs for [Community](http://docs.alfresco.com/community/concepts/alfresco-sdk-intro.html), [Enterprise](http://docs.alfresco.com/5.1/concepts/alfresco-sdk-intro.html), [Release notes](https://artifacts.alfresco.com/nexus/content/repositories/alfresco-docs/alfresco-sdk-aggregator/latest/github-report.html)
|
||||||
@@ -20,16 +21,15 @@ This project is released under the [Apache License, Version 2.0](http://www.apac
|
|||||||
## User Getting Started
|
## User Getting Started
|
||||||
|
|
||||||
### Latest Documentation
|
### Latest Documentation
|
||||||
To get started with Alfresco SDK 2.2.0 (latest) visit the offical Alfresco Documentation for:
|
To get started with **Alfresco SDK 3.0.x** (latest) visit the [Alfresco Documentation](https://docs.alfresco.com/5.2/concepts/sdk-intro.html)
|
||||||
|
|
||||||
- [Alfresco Community 5.1 and above](http://docs.alfresco.com/community/concepts/alfresco-sdk-intro.html)
|
|
||||||
- [Alfresco Enterprise 5.1 and above](http://docs.alfresco.com/5.1/concepts/alfresco-sdk-intro.html)
|
|
||||||
|
|
||||||
#### Previous versions Documentation
|
|
||||||
- Documentation for [Alfresco SDK 2.1](http://docs.alfresco.com/sdk2.1/concepts/alfresco-sdk-intro.html) (compatible with Alfresco 5.0.d Community and 5.0.1 Enterprise)
|
|
||||||
- Documentation for [Alfresco SDK 2.0](http://docs.alfresco.com/sdk2.0/concepts/alfresco-sdk-intro.html) (compatible with Alfresco 5.0.c Community and 5.0.0 Enterprise)
|
|
||||||
- Documentation for [Alfresco SDK 1.1.1](http://docs.alfresco.com/4.2/concepts/dev-extensions-maven-sdk-intro.html) (compatible with Alfresco 4.2)
|
|
||||||
|
|
||||||
|
#### Documentation about Previous Versions
|
||||||
|
| SDK Version | Alfresco Enterprise Version | Alfresco Community Version | Documentation |
|
||||||
|
| ------------- |:-------------:| :-----:|:-----|
|
||||||
|
| SDK 2.2 | Alfresco 5.1.x | Alfresco 5.1.x | https://docs.alfresco.com/5.1/concepts/alfresco-sdk-intro.html |
|
||||||
|
| SDK 2.1 | Alfresco 5.0.1 | Alfresco 5.0.d | https://docs.alfresco.com/sdk2.1/concepts/alfresco-sdk-intro.html |
|
||||||
|
| SDK 2.0 | Alfresco 5.0.0 | Alfresco 5.0.c | https://docs.alfresco.com/sdk2.0/concepts/alfresco-sdk-intro.html |
|
||||||
|
| SDK 1.1.1 | Alfresco 4.2.x | Alfresco 4.2.x | https://docs.alfresco.com/4.2/concepts/dev-extensions-maven-sdk-intro.html |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -37,19 +37,22 @@ To get started with Alfresco SDK 2.2.0 (latest) visit the offical Alfresco Docum
|
|||||||
Report issues (and contribute!) [here](https://github.com/Alfresco/alfresco-sdk/issues?milestone=1&state=open) or join us on the [IRC Channel](http://chat.alfresco.com/).
|
Report issues (and contribute!) [here](https://github.com/Alfresco/alfresco-sdk/issues?milestone=1&state=open) or join us on the [IRC Channel](http://chat.alfresco.com/).
|
||||||
|
|
||||||
## Alfresco Enterprise Customers and Partners Support
|
## Alfresco Enterprise Customers and Partners Support
|
||||||
If you are an Alfresco Customer please check the [SDK Support status](http://www.alfresco.com/services/subscription/technical-support/product-support-status) for the version you are using and the [Compatibily Matrix](http://docs.alfresco.com/community/concepts/alfresco-sdk-compatibility.html) for the SDK / Alfresco compatibility. If your version is in Limited or Full Support, you can raise issues via the [Support Portal](http://support.alfresco.com).
|
If you are an Alfresco Customer
|
||||||
|
please check the [SDK Support status](http://www.alfresco.com/services/subscription/technical-support/product-support-status)
|
||||||
|
for the version you are using. If your version is in Limited or Full Support and you need help, visit the [Support Portal](http://support.alfresco.com).
|
||||||
|
|
||||||
## Maven repositories
|
## Maven repositories
|
||||||
- As of version 2.0-beta-1, The Alfresco SDK is released in [Maven Central](http://search.maven.org/#search|ga|1|alfresco-sdk). Previous versions are available in the [Alfresco Artifacts Repository](https://artifacts.alfresco.com/).
|
- As of version 2.0-beta-1, The Alfresco SDK is released in [Maven Central](http://search.maven.org/#search|ga|1|alfresco-sdk). Previous versions are available in the [Alfresco Artifacts Repository](https://artifacts.alfresco.com/).
|
||||||
- Alfresco (Community and Enterprise) artifacts are hosted in the [Alfresco Artifacts Repository](https://artifacts.alfresco.com/).
|
- Alfresco (Community and Enterprise) artifacts are hosted in the [Alfresco Artifacts Repository](https://artifacts.alfresco.com/).
|
||||||
- Alfresco Community artifacts (JARs, WARs, AMPs, poms) and SDK artifacts are publicly available.
|
- Alfresco Community artifacts (JARs, WARs, AMPs, poms) and SDK artifacts are publicly available.
|
||||||
|
|
||||||
*NOTE:* For Enterprise and Premiere licensed software access you need to get credential via the Alfresco Enterprise Support. See [Maven Alfresco Enterprise setup](http://docs.alfresco.com/5.0/concepts/alfresco-sdk-using-enterprise-edition.html).
|
*NOTE:* By default the Alfresco SDK will use Community Edition releases but it can be configured to use Enterprise Edition releases. Enterprise and Premier customers can use the SDK with
|
||||||
|
Enterprise Edition releases by following the process described in [Working with Enterprise](https://docs.alfresco.com/5.2/concepts/sdk-using-enterprise.html)
|
||||||
|
|
||||||
### Alfresco Artifacts Repository
|
### Alfresco Artifacts Repository
|
||||||
|
|
||||||
#### Alfresco Releases
|
#### Alfresco Releases
|
||||||
You can use the following snippet in your pom.xml to access releases on Alfresco Artifact repository:
|
You can use the following snippet in your pom.xml to access releases from the Alfresco Artifact repository:
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<repository>
|
<repository>
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
<artifactId>alfresco-allinone-archetype</artifactId>
|
<artifactId>alfresco-allinone-archetype</artifactId>
|
||||||
<packaging>maven-archetype</packaging>
|
<packaging>maven-archetype</packaging>
|
||||||
<name>Alfresco SDK - All-in-One Archetype</name>
|
<name>Alfresco SDK - All-in-One Archetype</name>
|
||||||
<description>Sample multi-module project for All-in-One development on the Alfresco plaftorm. Includes modules for Platform/Repository JAR and Share JAR</description>
|
<description>Sample multi-module project for All-in-One development on the Alfresco platform. Includes modules for Platform/Repository JAR and Share JAR</description>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.alfresco.maven</groupId>
|
<groupId>org.alfresco.maven</groupId>
|
||||||
|
@@ -35,6 +35,11 @@
|
|||||||
<source>src/main/assembly/file-mapping.properties</source>
|
<source>src/main/assembly/file-mapping.properties</source>
|
||||||
<filtered>false</filtered>
|
<filtered>false</filtered>
|
||||||
</file>
|
</file>
|
||||||
|
<!-- Add module-specific log4j.properties configuration at top level in the AMP -->
|
||||||
|
<file>
|
||||||
|
<source>src/main/resources/alfresco/module/${project.artifactId}/log4j.properties</source>
|
||||||
|
<filtered>false</filtered>
|
||||||
|
</file>
|
||||||
</files>
|
</files>
|
||||||
|
|
||||||
<fileSets>
|
<fileSets>
|
||||||
|
@@ -0,0 +1 @@
|
|||||||
|
# Add here module-specific custom log4j.properties configuration
|
@@ -35,6 +35,11 @@
|
|||||||
<source>src/main/assembly/file-mapping.properties</source>
|
<source>src/main/assembly/file-mapping.properties</source>
|
||||||
<filtered>false</filtered>
|
<filtered>false</filtered>
|
||||||
</file>
|
</file>
|
||||||
|
<!-- Add module-specific log4j.properties configuration at top level in the AMP -->
|
||||||
|
<file>
|
||||||
|
<source>src/main/resources/alfresco/module/${project.artifactId}/log4j.properties</source>
|
||||||
|
<filtered>false</filtered>
|
||||||
|
</file>
|
||||||
</files>
|
</files>
|
||||||
|
|
||||||
<fileSets>
|
<fileSets>
|
||||||
|
@@ -0,0 +1 @@
|
|||||||
|
# Add here module-specific custom log4j.properties configuration
|
@@ -35,6 +35,11 @@
|
|||||||
<source>src/main/assembly/file-mapping.properties</source>
|
<source>src/main/assembly/file-mapping.properties</source>
|
||||||
<filtered>false</filtered>
|
<filtered>false</filtered>
|
||||||
</file>
|
</file>
|
||||||
|
<!-- Add module-specific log4j.properties configuration at top level in the AMP -->
|
||||||
|
<file>
|
||||||
|
<source>src/main/resources/alfresco/module/${project.artifactId}/log4j.properties</source>
|
||||||
|
<filtered>false</filtered>
|
||||||
|
</file>
|
||||||
</files>
|
</files>
|
||||||
|
|
||||||
<fileSets>
|
<fileSets>
|
||||||
|
@@ -0,0 +1 @@
|
|||||||
|
# Add here module-specific custom log4j.properties configuration
|
@@ -35,6 +35,11 @@
|
|||||||
<source>src/main/assembly/file-mapping.properties</source>
|
<source>src/main/assembly/file-mapping.properties</source>
|
||||||
<filtered>false</filtered>
|
<filtered>false</filtered>
|
||||||
</file>
|
</file>
|
||||||
|
<!-- Add module-specific log4j.properties configuration at top level in the AMP -->
|
||||||
|
<file>
|
||||||
|
<source>src/main/resources/alfresco/module/${project.artifactId}/log4j.properties</source>
|
||||||
|
<filtered>false</filtered>
|
||||||
|
</file>
|
||||||
</files>
|
</files>
|
||||||
|
|
||||||
<fileSets>
|
<fileSets>
|
||||||
|
@@ -0,0 +1 @@
|
|||||||
|
# Add here module-specific custom log4j.properties configuration
|
@@ -140,6 +140,11 @@
|
|||||||
<artifactId>zt-zip</artifactId>
|
<artifactId>zt-zip</artifactId>
|
||||||
<version>1.11</version>
|
<version>1.11</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.schlichtherle.truezip</groupId>
|
||||||
|
<artifactId>truezip-kernel</artifactId>
|
||||||
|
<version>7.7.9</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<reporting>
|
<reporting>
|
||||||
|
@@ -17,9 +17,13 @@
|
|||||||
*/
|
*/
|
||||||
package org.alfresco.maven.plugin;
|
package org.alfresco.maven.plugin;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import de.schlichtherle.truezip.file.TVFS;
|
||||||
|
import de.schlichtherle.truezip.fs.FsSyncException;
|
||||||
import org.alfresco.maven.plugin.config.ModuleDependency;
|
import org.alfresco.maven.plugin.config.ModuleDependency;
|
||||||
import org.alfresco.maven.plugin.config.TomcatDependency;
|
import org.alfresco.maven.plugin.config.TomcatDependency;
|
||||||
import org.alfresco.maven.plugin.config.TomcatWebapp;
|
import org.alfresco.maven.plugin.config.TomcatWebapp;
|
||||||
|
import org.alfresco.util.Pair;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||||
import org.apache.http.client.methods.HttpGet;
|
import org.apache.http.client.methods.HttpGet;
|
||||||
@@ -40,6 +44,7 @@ import java.io.File;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import static org.twdata.maven.mojoexecutor.MojoExecutor.*;
|
import static org.twdata.maven.mojoexecutor.MojoExecutor.*;
|
||||||
|
|
||||||
@@ -67,6 +72,31 @@ public abstract class AbstractRunMojo extends AbstractMojo {
|
|||||||
public static final String ALFRESCO_ENTERPRISE_EDITION = "enterprise";
|
public static final String ALFRESCO_ENTERPRISE_EDITION = "enterprise";
|
||||||
public static final String ALFRESCO_COMMUNITY_EDITION = "community";
|
public static final String ALFRESCO_COMMUNITY_EDITION = "community";
|
||||||
|
|
||||||
|
private static final String TOMCAT_GROUP_ID = "org.apache.tomcat";
|
||||||
|
private static final String TOMCAT_EMBED_GROUP_ID = "org.apache.tomcat.embed";
|
||||||
|
private static final Set<Pair<String, String>> TOMCAT_DEPENDENCIES = new ImmutableSet.Builder<Pair<String, String>>()
|
||||||
|
.add(new Pair(TOMCAT_EMBED_GROUP_ID,"tomcat-embed-core"))
|
||||||
|
.add(new Pair(TOMCAT_GROUP_ID,"tomcat-util"))
|
||||||
|
.add(new Pair(TOMCAT_GROUP_ID,"tomcat-coyote"))
|
||||||
|
.add(new Pair(TOMCAT_GROUP_ID,"tomcat-api"))
|
||||||
|
.add(new Pair(TOMCAT_GROUP_ID,"tomcat-jdbc"))
|
||||||
|
.add(new Pair(TOMCAT_GROUP_ID,"tomcat-dbcp"))
|
||||||
|
.add(new Pair(TOMCAT_GROUP_ID,"tomcat-servlet-api"))
|
||||||
|
.add(new Pair(TOMCAT_GROUP_ID,"tomcat-jsp-api"))
|
||||||
|
.add(new Pair(TOMCAT_GROUP_ID,"tomcat-jasper"))
|
||||||
|
.add(new Pair(TOMCAT_GROUP_ID,"tomcat-jasper-el"))
|
||||||
|
.add(new Pair(TOMCAT_GROUP_ID,"tomcat-el-api"))
|
||||||
|
.add(new Pair(TOMCAT_GROUP_ID,"tomcat-catalina"))
|
||||||
|
.add(new Pair(TOMCAT_GROUP_ID,"tomcat-tribes"))
|
||||||
|
.add(new Pair(TOMCAT_GROUP_ID,"tomcat-catalina-ha"))
|
||||||
|
.add(new Pair(TOMCAT_GROUP_ID,"tomcat-annotations-api"))
|
||||||
|
.add(new Pair(TOMCAT_GROUP_ID,"tomcat-juli"))
|
||||||
|
.add(new Pair(TOMCAT_EMBED_GROUP_ID,"tomcat-embed-logging-juli"))
|
||||||
|
.add(new Pair(TOMCAT_EMBED_GROUP_ID,"tomcat-embed-logging-log4j"))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
private static final String AMP_LOCATION_PATTERN = "%s/%s-%s.amp";
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
protected MavenProject project;
|
protected MavenProject project;
|
||||||
|
|
||||||
@@ -357,6 +387,13 @@ public abstract class AbstractRunMojo extends AbstractMojo {
|
|||||||
@Parameter(property = "solr.alfresco.cron", defaultValue = "0/15 * * * * ? *")
|
@Parameter(property = "solr.alfresco.cron", defaultValue = "0/15 * * * * ? *")
|
||||||
protected String solrCron;
|
protected String solrCron;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tomcat version to be used in the Maven Tomcat Plugin. If this parameter is not set, then the
|
||||||
|
* default Tomcat version will be used (it depends on the version of the Tomcat Maven Plugin).
|
||||||
|
*/
|
||||||
|
@Parameter(property = "maven.alfresco.tomcat.version")
|
||||||
|
protected String tomcatVersion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maven GAV properties for customized alfresco.war, share.war, activiti-app.war
|
* Maven GAV properties for customized alfresco.war, share.war, activiti-app.war
|
||||||
* Used by the Maven Tomcat 7 Plugin
|
* Used by the Maven Tomcat 7 Plugin
|
||||||
@@ -1201,18 +1238,7 @@ public abstract class AbstractRunMojo extends AbstractMojo {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Then apply all these amps to the unpacked war
|
// Then apply all these amps to the unpacked war
|
||||||
// Call the Alfresco Maven Plugin Install Mojo directly, so we don't have to keep SDK version info here
|
applyAMPs(warName, modules);
|
||||||
String ampsLocation = project.getBuild().getDirectory() + "/" + ampsModuleDir;
|
|
||||||
String warLocation = project.getBuild().getDirectory() + "/" + getWarName(warName);
|
|
||||||
InstallMojo installMojo = new InstallMojo();
|
|
||||||
installMojo.setAmpLocation(new File(ampsLocation));
|
|
||||||
installMojo.setWarLocation(new File(warLocation));
|
|
||||||
installMojo.setForce(true);
|
|
||||||
try {
|
|
||||||
installMojo.execute();
|
|
||||||
} catch (MojoFailureException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then copy all JAR dependencies to the unpacked war /target/<warName>-war/WEB-INF/lib
|
// Then copy all JAR dependencies to the unpacked war /target/<warName>-war/WEB-INF/lib
|
||||||
@@ -1231,6 +1257,13 @@ public abstract class AbstractRunMojo extends AbstractMojo {
|
|||||||
execEnv
|
execEnv
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Force the unmount of all the files mounted with TrueZIP to avoid an exception in the FsSyncShutdownHook
|
||||||
|
try {
|
||||||
|
TVFS.umount();
|
||||||
|
} catch (final FsSyncException e) {
|
||||||
|
getLog().error(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1350,6 +1383,11 @@ public abstract class AbstractRunMojo extends AbstractMojo {
|
|||||||
dependency("org.postgresql", "postgresql", "9.4-1201-jdbc41"));
|
dependency("org.postgresql", "postgresql", "9.4-1201-jdbc41"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If a custom version of Tomcat is required add the corresponding dependencies
|
||||||
|
if(StringUtils.isNotBlank(tomcatVersion)) {
|
||||||
|
addTomcatDependencies(tomcatPluginDependencies);
|
||||||
|
}
|
||||||
|
|
||||||
if (enablePlatform) {
|
if (enablePlatform) {
|
||||||
webapps2Deploy.add(createWebAppElement(
|
webapps2Deploy.add(createWebAppElement(
|
||||||
runnerAlfrescoGroupId, runnerAlfrescoPlatformWarArtifactId, runnerAlfrescoPlatformVersion,
|
runnerAlfrescoGroupId, runnerAlfrescoPlatformWarArtifactId, runnerAlfrescoPlatformVersion,
|
||||||
@@ -1797,4 +1835,68 @@ public abstract class AbstractRunMojo extends AbstractMojo {
|
|||||||
private String getWarName(String baseWarName) {
|
private String getWarName(String baseWarName) {
|
||||||
return baseWarName + "-war";
|
return baseWarName + "-war";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add all the required maven dependencies to execute a specific version of Tomcat set by the property <code>tomcatVersion</code> to the list of
|
||||||
|
* dependencies of the Tomcat Maven Plugin.
|
||||||
|
*
|
||||||
|
* @param tomcatPluginDependencies current list of dependencies of the Tomcat Maven Plugin
|
||||||
|
*/
|
||||||
|
private void addTomcatDependencies(List<Dependency> tomcatPluginDependencies) {
|
||||||
|
for(Pair<String, String> tomcatDependency : TOMCAT_DEPENDENCIES) {
|
||||||
|
tomcatPluginDependencies.add(dependency(tomcatDependency.getFirst(),tomcatDependency.getSecond(),tomcatVersion));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply a list of AMPs to a specific war file.
|
||||||
|
*
|
||||||
|
* @param warName the name of the war file to apply the AMPs to
|
||||||
|
* @param modules the list of proposed modules to be applied to the war file. Only the AMP files will be applied
|
||||||
|
* @throws MojoExecutionException when any problem appears applying the AMPs to the war
|
||||||
|
*/
|
||||||
|
private void applyAMPs(String warName, List<ModuleDependency> modules) throws MojoExecutionException {
|
||||||
|
final String ampsModuleDir = "modules/" + warName + "/amps";
|
||||||
|
final String ampsLocation = project.getBuild().getDirectory() + "/" + ampsModuleDir;
|
||||||
|
final String warLocation = project.getBuild().getDirectory() + "/" + getWarName(warName);
|
||||||
|
|
||||||
|
// Apply one AMP module each time to preserve the order applying the AMPs to the war
|
||||||
|
for(ModuleDependency module : modules) {
|
||||||
|
if(module.isAmp()) {
|
||||||
|
applyAMP(ampsLocation, warLocation, module);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply an AMP to a specific war file.
|
||||||
|
*
|
||||||
|
* @param ampsLocation the location of the folder where the AMP is located
|
||||||
|
* @param warLocation the location of the war file to apply the AMP to
|
||||||
|
* @param ampModule the module that represents the AMP to apply
|
||||||
|
* @throws MojoExecutionException when any problem appears applying the AMP to the war
|
||||||
|
*/
|
||||||
|
private void applyAMP(String ampsLocation, String warLocation, ModuleDependency ampModule) throws MojoExecutionException {
|
||||||
|
// Call the Alfresco Maven Plugin Install Mojo directly, so we don't have to keep SDK version info here
|
||||||
|
InstallMojo installMojo = new InstallMojo();
|
||||||
|
installMojo.setAmpLocation(new File(getAMPLocation(ampsLocation, ampModule)));
|
||||||
|
installMojo.setWarLocation(new File(warLocation));
|
||||||
|
installMojo.setForce(true);
|
||||||
|
try {
|
||||||
|
installMojo.execute();
|
||||||
|
} catch (MojoFailureException e) {
|
||||||
|
getLog().error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build the location of an AMP file.
|
||||||
|
*
|
||||||
|
* @param ampsLocation the location of the folder where the AMPs are located
|
||||||
|
* @param ampModule the {@link ModuleDependency} of the AMP to build its location
|
||||||
|
* @return the location of the AMP file
|
||||||
|
*/
|
||||||
|
private String getAMPLocation(String ampsLocation, ModuleDependency ampModule) {
|
||||||
|
return String.format(AMP_LOCATION_PATTERN, ampsLocation, ampModule.getArtifactId(), ampModule.getVersion());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user