Class 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 Detail

      • 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 enablePlatform
        Switch to enable/disable the Platform/Repository (alfresco.war) when running embedded Tomcat.
      • copyHotswapAgentConfig

        @Parameter(property="maven.alfresco.copyHotswapAgentConfig",
                   defaultValue="true")
        protected boolean copyHotswapAgentConfig
        Enable or disable generation of Hotswap Agent configuration
      • enableShare

        @Parameter(property="maven.alfresco.enableShare",
                   defaultValue="true")
        protected boolean enableShare
        Switch to enable/disable the Share (share.war) when running embedded Tomcat.
      • shareContextPath

        @Parameter(property="maven.alfresco.shareContextPath",
                   defaultValue="/share")
        protected String shareContextPath
        Enables 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 useCustomShareLog4jConfig
        Share 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 enableApiExplorer
        Switch 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 enableTestProperties
        Switch to enable/disable test properties when running embedded Tomcat.
      • startTomcat

        @Parameter(property="maven.alfresco.startTomcat",
                   defaultValue="true")
        protected boolean startTomcat
        Control 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 testFolder
        Directory containing test files that should be used when running embedded Tomcat
      • testInclude

        @Parameter(property="maven.alfresco.testInclude",
                   defaultValue="**")
        protected String testInclude
        Test files in testFolder that should be included when running embedded Tomcat
      • platformModules

        @Parameter(property="maven.alfresco.platform.modules",
                   defaultValue="")
        protected List<ModuleDependency> platformModules
        JARs 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> shareModules
        JARs 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> tomcatDependencies
        Tomcat 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> tomcatSystemProperties
        System 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> tomcatCustomWebapps
        Custom 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 tomcatPort
        Port to run Tomcat on
      • mavenTomcatPort

        @Parameter(property="maven.tomcat.port",
                   defaultValue="")
        protected String mavenTomcatPort
        Legacy to be compatible with maven.tomcat.port
      • alfrescoGroupId

        @Parameter(property="alfresco.groupId",
                   defaultValue="org.alfresco")
        protected String alfrescoGroupId
        Maven 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
    • Constructor Detail

      • AbstractRunMojo

        public AbstractRunMojo()
    • 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:
        true if Tomcat is already running, false otherwise
      • copyAlfrescoGlobalProperties

        protected void copyAlfrescoGlobalProperties()
                                             throws org.apache.maven.plugin.MojoExecutionException
        Copy 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.MojoExecutionException
        Copy 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.MojoExecutionException
        Copy 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.MojoExecutionException
        Copy 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.MojoExecutionException
        Build 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.MojoExecutionException
        Build 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 war
        modules - the modules that should be applied to the custom war
        originalWarGroupId - the Maven groupId for the original war file that should be customized
        originalWarArtifactId - the Maven artifactId for the original war file that should be customized
        originalWarVersion - 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