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.AbstractMojoAbstract 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
Fields Modifier and Type Field Description protected StringalfrescoApiExplorerArtifactIdprotected StringalfrescoApiExplorerVersionprotected StringalfrescoGroupIdMaven GAV properties for standard Alfresco web applications.protected StringalfrescoPlatformVersionprotected StringalfrescoPlatformWarArtifactIdprotected StringalfrescoShareVersionprotected StringalfrescoShareWarArtifactIdprotected booleancopyHotswapAgentConfigEnable or disable generation of Hotswap Agent configurationprotected booleanenableApiExplorerSwitch to enable/disable the Alfresco REST API Explorer (api-explorer.war) when running embedded Tomcat.protected booleanenablePlatformSwitch to enable/disable the Platform/Repository (alfresco.war) when running embedded Tomcat.protected booleanenableShareSwitch to enable/disable the Share (share.war) when running embedded Tomcat.protected booleanenableTestPropertiesSwitch to enable/disable test properties when running embedded Tomcat.protected org.twdata.maven.mojoexecutor.MojoExecutor.ExecutionEnvironmentexecEnvThe Maven environment that this mojo is executed instatic StringMAVEN_DEPENDENCY_PLUGIN_VERSIONstatic StringMAVEN_INSTALL_PLUGIN_VERSIONstatic StringMAVEN_REPLACER_PLUGIN_VERSIONstatic StringMAVEN_RESOURCE_PLUGIN_VERSIONstatic StringMAVEN_TOMCAT7_PLUGIN_VERSIONprotected StringmavenTomcatPortLegacy to be compatible with maven.tomcat.portstatic StringPLATFORM_WAR_PREFIX_NAMEprotected List<ModuleDependency>platformModulesJARs and AMPs that should be overlayed/applied to the Platform/Repository WAR (i.e.protected org.apache.maven.plugin.BuildPluginManagerpluginManagerprotected org.apache.maven.project.MavenProjectprojectprotected org.apache.maven.execution.MavenSessionsessionstatic StringSHARE_WAR_PREFIX_NAMEprotected StringshareContextPathEnables the use of custom context path for the Share webapp.protected List<ModuleDependency>shareModulesJARs and AMPs that should be overlayed/applied to the Share WAR (i.e.protected booleanstartTomcatControl if Tomcat 7 Plugin should be kicked off and start Apache Tomcatprotected StringtestFolderDirectory containing test files that should be used when running embedded Tomcatprotected StringtestIncludeTest files in testFolder that should be included when running embedded Tomcatprotected List<TomcatWebapp>tomcatCustomWebappsCustom webapps that should be deployed to the embedded Tomcat engine.protected List<TomcatDependency>tomcatDependenciesTomcat Dependencies that should be added to the Embedded Tomcat configuration before start.protected StringtomcatPortPort to run Tomcat onprotected Map<String,String>tomcatSystemPropertiesSystem Properties to feed the Tomcat plugin before start.protected booleanuseCustomShareLog4jConfigShare Log4j.properties configuration cannot be customized via extension put on the classpath, like on the platform side.
-
Constructor Summary
Constructors Constructor Description AbstractRunMojo()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected 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 voidbuildPlatformWar()Build the customized Platform webapp (i.e.protected voidbuildShareWar()Build the customized Share webapp (i.e.protected voidcopyAlfrescoGlobalProperties()Copy the alfresco-global.properties files.protected voidcopyAlfrescoLicense()Copy 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 voidcopyShareConfigCustom()Copy Share Config Custom in order to have global overrides for development and dynamic portprotected voidcopyShareLog4jConfig()Copy 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 booleantomcatIsRunning()Check if Tomcat is already running.-
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
-
-
-
Field Detail
-
MAVEN_DEPENDENCY_PLUGIN_VERSION
public static final String MAVEN_DEPENDENCY_PLUGIN_VERSION
- See Also:
- Constant Field Values
-
MAVEN_INSTALL_PLUGIN_VERSION
public static final String MAVEN_INSTALL_PLUGIN_VERSION
- See Also:
- Constant Field Values
-
MAVEN_REPLACER_PLUGIN_VERSION
public static final String MAVEN_REPLACER_PLUGIN_VERSION
- See Also:
- Constant Field Values
-
MAVEN_RESOURCE_PLUGIN_VERSION
public static final String MAVEN_RESOURCE_PLUGIN_VERSION
- See Also:
- Constant Field Values
-
MAVEN_TOMCAT7_PLUGIN_VERSION
public static final String MAVEN_TOMCAT7_PLUGIN_VERSION
- See Also:
- Constant Field Values
-
PLATFORM_WAR_PREFIX_NAME
public static final String PLATFORM_WAR_PREFIX_NAME
- See Also:
- Constant Field Values
-
SHARE_WAR_PREFIX_NAME
public static final String SHARE_WAR_PREFIX_NAME
- See Also:
- Constant Field Values
-
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
-
enableShare
@Parameter(property="maven.alfresco.enableShare", defaultValue="true") protected boolean enableShareSwitch to enable/disable the Share (share.war) when running embedded Tomcat.
-
shareContextPath
@Parameter(property="maven.alfresco.shareContextPath", defaultValue="/share") protected String shareContextPathEnables the use of custom context path for the Share webapp. Some solution integrators uses a custom context path for Share in their projects. This property enables them to continue to do that in SDK 3 without having to completely override the Maven Tomcat plugin configuration, or not use it at all and go back the good old runner project again...
-
useCustomShareLog4jConfig
@Parameter(property="maven.alfresco.useCustomShareLog4jConfig", defaultValue="true") protected boolean useCustomShareLog4jConfigShare Log4j.properties configuration cannot be customized via extension put on the classpath, like on the platform side. So we need to override the log4j.properties in share/WEB-INF/classes to be able to log from custom code. This property can be used to turn off this overriding, to produce a WAR with the standard Share log4j.properties file.
-
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
@Parameter(property="maven.alfresco.testInclude", defaultValue="**") protected String testIncludeTest 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)
-
shareModules
@Parameter(property="maven.alfresco.share.modules", defaultValue="") protected List<ModuleDependency> shareModulesJARs and AMPs that should be overlayed/applied to the Share WAR (i.e. share.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
@Parameter(property="maven.alfresco.tomcat.port", defaultValue="8080") protected String tomcatPortPort to run Tomcat on
-
mavenTomcatPort
@Parameter(property="maven.tomcat.port", defaultValue="") protected String mavenTomcatPortLegacy 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
-
alfrescoShareWarArtifactId
@Parameter(property="alfresco.share.war.artifactId", defaultValue="share") protected String alfrescoShareWarArtifactId
-
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
-
alfrescoShareVersion
@Parameter(property="alfresco.share.version", defaultValue="6.0.7-ga") protected String alfrescoShareVersion
-
alfrescoApiExplorerVersion
@Parameter(property="alfresco.api.explorer.version", defaultValue="6.0.7-ga") protected String alfrescoApiExplorerVersion
-
execEnv
protected org.twdata.maven.mojoexecutor.MojoExecutor.ExecutionEnvironment execEnv
The Maven environment that this mojo is executed in
-
-
Method Detail
-
getPort
protected String 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
-
copyShareConfigCustom
protected void copyShareConfigCustom() throws org.apache.maven.plugin.MojoExecutionExceptionCopy Share Config Custom in order to have global overrides for development and dynamic port- Throws:
org.apache.maven.plugin.MojoExecutionException- when any problem appears copying share config custom file
-
copyShareLog4jConfig
protected void copyShareLog4jConfig() throws org.apache.maven.plugin.MojoExecutionExceptionCopy a custom Share Log4J config into the share-war/WEB-INF/classes dir. There is no custom classpath resolve mechanism for Share log4j, to log custom stuff overriding standard log4j.properties is needed.- Throws:
org.apache.maven.plugin.MojoExecutionException- when any problem appears copying the share log4j configuration
-
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
-
buildShareWar
protected void buildShareWar() throws org.apache.maven.plugin.MojoExecutionExceptionBuild the customized Share webapp (i.e. the share.war) that should be deployed by Tomcat by applying all AMPs and JARs from the<shareModules>configuration.- Throws:
org.apache.maven.plugin.MojoExecutionException- when any problem appears building the share 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.MojoExecutionExceptionStart 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
-
-