Package org.alfresco.maven.plugin
Class AbstractRunMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.alfresco.maven.plugin.AbstractRunMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
- Direct Known Subclasses:
IntegrationTestMojo,RunMojo
public abstract class AbstractRunMojo
extends org.apache.maven.plugin.AbstractMojo
Abstract runner component used by both the standard runner that blocks after startup and the
integration test runner that stops container after each sub-project execution.
- Since:
- 3.0
- Version:
- 1.0
- Author:
- ole.hejlskov, martin.bergljung
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Stringprotected StringMaven GAV properties for standard Alfresco web applications.protected Stringprotected Stringprotected Stringprotected Stringprotected booleanEnable or disable generation of Hotswap Agent configurationprotected booleanSwitch to enable/disable the Alfresco REST API Explorer (api-explorer.war) when running embedded Tomcat.protected booleanSwitch to enable/disable the Platform/Repository (alfresco.war) when running embedded Tomcat.protected booleanSwitch to enable/disable the Share (share.war) when running embedded Tomcat.protected booleanSwitch to enable/disable test properties when running embedded Tomcat.protected org.twdata.maven.mojoexecutor.MojoExecutor.ExecutionEnvironmentThe Maven environment that this mojo is executed instatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected StringLegacy to be compatible with maven.tomcat.portstatic final Stringprotected List<ModuleDependency>JARs and AMPs that should be overlayed/applied to the Platform/Repository WAR (i.e.protected org.apache.maven.plugin.BuildPluginManagerprotected org.apache.maven.project.MavenProjectprotected org.apache.maven.execution.MavenSessionstatic final Stringprotected StringEnables the use of custom context path for the Share webapp.protected List<ModuleDependency>JARs and AMPs that should be overlayed/applied to the Share WAR (i.e.protected booleanControl if Tomcat 7 Plugin should be kicked off and start Apache Tomcatprotected StringDirectory containing test files that should be used when running embedded Tomcatprotected StringTest files in testFolder that should be included when running embedded Tomcatprotected List<TomcatWebapp>Custom webapps that should be deployed to the embedded Tomcat engine.protected List<TomcatDependency>Tomcat Dependencies that should be added to the Embedded Tomcat configuration before start.protected StringPort to run Tomcat onSystem Properties to feed the Tomcat plugin before start.protected booleanShare Log4j.properties configuration cannot be customized via extension put on the classpath, like on the platform side.Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidbuildCustomWarInDir(String warName, List<ModuleDependency> modules, String originalWarGroupId, String originalWarArtifactId, String originalWarVersion) Build a customized webapp in a directory, applying a number of AMPs and/or JARs from alfresco maven plugin configuration.protected voidBuild the customized Platform webapp (i.e.protected voidBuild the customized Share webapp (i.e.protected voidCopy the alfresco-global.properties files.protected voidCopy the Alfresco Enterprise license to its correct place in the Platform WAR, if it exists.protected voidcopyHotswapAgentProperties(String warPrefix) Copy and Build hotswap-agent.propertiesprotected voidCopy Share Config Custom in order to have global overrides for development and dynamic portprotected voidCopy a custom Share Log4J config into the share-war/WEB-INF/classes dir.protected StringgetPort()Get the Tomcat port.protected StringpackageAndInstallCustomWar(String warName) Package customized war file and install it in local maven repo.protected voidstartTomcat(boolean fork) Start up the embedded Tomcat server with the webapps that has been configured in the SDK project.protected booleanCheck if Tomcat is already running.Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContextMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.maven.plugin.Mojo
execute
-
Field Details
-
MAVEN_DEPENDENCY_PLUGIN_VERSION
- See Also:
-
MAVEN_INSTALL_PLUGIN_VERSION
- See Also:
-
MAVEN_REPLACER_PLUGIN_VERSION
- See Also:
-
MAVEN_RESOURCE_PLUGIN_VERSION
- See Also:
-
MAVEN_TOMCAT7_PLUGIN_VERSION
- See Also:
-
PLATFORM_WAR_PREFIX_NAME
- See Also:
-
SHARE_WAR_PREFIX_NAME
- See Also:
-
project
@Component protected org.apache.maven.project.MavenProject project -
session
@Component protected org.apache.maven.execution.MavenSession session -
pluginManager
@Component protected org.apache.maven.plugin.BuildPluginManager pluginManager -
enablePlatform
@Parameter(property="maven.alfresco.enablePlatform", defaultValue="true") protected boolean enablePlatformSwitch to enable/disable the Platform/Repository (alfresco.war) when running embedded Tomcat. -
copyHotswapAgentConfig
@Parameter(property="maven.alfresco.copyHotswapAgentConfig", defaultValue="true") protected boolean copyHotswapAgentConfigEnable or disable generation of Hotswap Agent configuration -
enableApiExplorer
@Parameter(property="maven.alfresco.enableApiExplorer", defaultValue="false") protected boolean enableApiExplorerSwitch to enable/disable the Alfresco REST API Explorer (api-explorer.war) when running embedded Tomcat. -
enableTestProperties
@Parameter(property="maven.alfresco.enableTestProperties", defaultValue="true") protected boolean enableTestPropertiesSwitch to enable/disable test properties when running embedded Tomcat. -
startTomcat
@Parameter(property="maven.alfresco.startTomcat", defaultValue="true") protected boolean startTomcatControl if Tomcat 7 Plugin should be kicked off and start Apache Tomcat -
testFolder
@Parameter(property="maven.alfresco.testFolder", defaultValue="src/test/properties/${env}") protected String testFolderDirectory containing test files that should be used when running embedded Tomcat -
testInclude
Test files in testFolder that should be included when running embedded Tomcat -
platformModules
@Parameter(property="maven.alfresco.platform.modules", defaultValue="") protected List<ModuleDependency> platformModulesJARs and AMPs that should be overlayed/applied to the Platform/Repository WAR (i.e. alfresco.war) -
tomcatDependencies
@Parameter(property="maven.alfresco.tomcat.dependencies", defaultValue="") protected List<TomcatDependency> tomcatDependenciesTomcat Dependencies that should be added to the Embedded Tomcat configuration before start. Normally there would not be any extra dependencies, but could be if you run an Enterprise database such as Oracle, for which there's no quick config, such as enableH2, enableMySQL, or enablePostgreSQL. -
tomcatSystemProperties
@Parameter(property="maven.alfresco.tomcat.system.properties", defaultValue="") protected Map<String,String> tomcatSystemPropertiesSystem Properties to feed the Tomcat plugin before start. Normally there would not be any extra dependencies, but we could run a custom webapp that needed a custom sys prop set. -
tomcatCustomWebapps
@Parameter(property="maven.alfresco.tomcat.custom.webapps", defaultValue="") protected List<TomcatWebapp> tomcatCustomWebappsCustom webapps that should be deployed to the embedded Tomcat engine. Normally there would not be any extra webapps, but we could run a bigger project that uses some custom webapp. -
tomcatPort
Port to run Tomcat on -
mavenTomcatPort
Legacy to be compatible with maven.tomcat.port -
alfrescoGroupId
@Parameter(property="alfresco.groupId", defaultValue="org.alfresco") protected String alfrescoGroupIdMaven GAV properties for standard Alfresco web applications. -
alfrescoPlatformWarArtifactId
@Parameter(property="alfresco.platform.war.artifactId", defaultValue="content-services-community") protected String alfrescoPlatformWarArtifactId -
alfrescoApiExplorerArtifactId
@Parameter(property="alfresco.api.explorer.artifactId", defaultValue="api-explorer") protected String alfrescoApiExplorerArtifactId -
alfrescoPlatformVersion
@Parameter(property="alfresco.platform.version", defaultValue="6.0.7-ga") protected String alfrescoPlatformVersion -
alfrescoApiExplorerVersion
@Parameter(property="alfresco.api.explorer.version", defaultValue="6.0.7-ga") protected String alfrescoApiExplorerVersion -
execEnv
protected org.twdata.maven.mojoexecutor.MojoExecutor.ExecutionEnvironment execEnvThe Maven environment that this mojo is executed in
-
-
Constructor Details
-
AbstractRunMojo
public AbstractRunMojo()
-
-
Method Details
-
getPort
Get the Tomcat port. By default the port is changed by using the maven.alfresco.tomcat.port property but for legacy and external configuration purposes maven.tomcat.port will override if defined- Returns:
- the Tomcat port
-
tomcatIsRunning
protected boolean tomcatIsRunning()Check if Tomcat is already running.- Returns:
trueif Tomcat is already running,falseotherwise
-
copyAlfrescoGlobalProperties
protected void copyAlfrescoGlobalProperties() throws org.apache.maven.plugin.MojoExecutionExceptionCopy the alfresco-global.properties files. It contains database connection parameters and other general configuration for Alfresco Repository (alfresco.war)- Throws:
org.apache.maven.plugin.MojoExecutionException- when any problem appears copying the Alfresco global properties file
-
copyAlfrescoLicense
protected void copyAlfrescoLicense() throws org.apache.maven.plugin.MojoExecutionExceptionCopy the Alfresco Enterprise license to its correct place in the Platform WAR, if it exists. It is not enough to have it on the test classpath, then it will start up as Trial license...- Throws:
org.apache.maven.plugin.MojoExecutionException- when any problem appears copying the Alfresco license
-
copyHotswapAgentProperties
protected void copyHotswapAgentProperties(String warPrefix) throws org.apache.maven.plugin.MojoExecutionException Copy and Build hotswap-agent.properties- Parameters:
warPrefix- path to the war root directory- Throws:
org.apache.maven.plugin.MojoExecutionException- when any problem appears copying hotswap agent properties
-
buildPlatformWar
protected void buildPlatformWar() throws org.apache.maven.plugin.MojoExecutionExceptionBuild the customized Platform webapp (i.e. the Repository, alfresco.war) that should be deployed by Tomcat by applying all AMPs and JARs from the<platformModules>configuration.- Throws:
org.apache.maven.plugin.MojoExecutionException- when any problem appears building the platform war
-
buildCustomWarInDir
protected void buildCustomWarInDir(String warName, List<ModuleDependency> modules, String originalWarGroupId, String originalWarArtifactId, String originalWarVersion) throws org.apache.maven.plugin.MojoExecutionException Build a customized webapp in a directory, applying a number of AMPs and/or JARs from alfresco maven plugin configuration.- Parameters:
warName- the name of the custom warmodules- the modules that should be applied to the custom waroriginalWarGroupId- the Maven groupId for the original war file that should be customizedoriginalWarArtifactId- the Maven artifactId for the original war file that should be customizedoriginalWarVersion- the Maven version for the original war file that should be customized- Throws:
org.apache.maven.plugin.MojoExecutionException- when any problem appears building the custom war
-
packageAndInstallCustomWar
protected String packageAndInstallCustomWar(String warName) throws org.apache.maven.plugin.MojoExecutionException Package customized war file and install it in local maven repo.- Parameters:
warName- the name of the custom war- Returns:
- the customized war file artifactId, to be used by the tomcat7 plugin
- Throws:
org.apache.maven.plugin.MojoExecutionException- when any problem appears packaging or installing the custom war
-
startTomcat
protected void startTomcat(boolean fork) throws org.apache.maven.plugin.MojoExecutionException Start up the embedded Tomcat server with the webapps that has been configured in the SDK project.- Parameters:
fork- true if tomcat process should be forked- Throws:
org.apache.maven.plugin.MojoExecutionException- when any problem appears starting tomcat
-