mirror of
https://github.com/Alfresco/alfresco-sdk.git
synced 2025-08-14 17:59:13 +00:00
Add hotswap-agent.properties for both platform and share jars
This commit is contained in:
@@ -143,6 +143,12 @@
|
||||
<include>**/dev-log4j.properties</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet encoding="UTF-8" filtered="true">
|
||||
<directory>src/test/resources</directory>
|
||||
<includes>
|
||||
<include>*hotswap-agent.properties</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet encoding="UTF-8" filtered="false">
|
||||
<directory>src/test/resources</directory>
|
||||
<includes>
|
||||
@@ -150,6 +156,7 @@
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/dev-log4j.properties</exclude>
|
||||
<exclude>*hotswap-agent.properties</exclude>
|
||||
</excludes>
|
||||
</fileSet>
|
||||
<fileSet encoding="UTF-8" filtered="false">
|
||||
|
@@ -30,8 +30,24 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<testResources>
|
||||
<testResource>
|
||||
<directory>src/test/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</testResource>
|
||||
</testResources>
|
||||
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.zeroturnaround</groupId>
|
||||
<artifactId>jrebel-maven-plugin</artifactId>
|
||||
<version>${jrebel.version}</version>
|
||||
<configuration>
|
||||
<rebelXmlDirectory>${project.build.testOutputDirectory}</rebelXmlDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- Make sure we attach the tests so we can include them when running -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@@ -46,34 +62,6 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Filter the test resource files in the IT project, and do property substitutions.
|
||||
We need this config so this is done before the Alfresco Maven Plugin 'it' is executed. -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<inherited>false</inherited>
|
||||
<!-- Run only for the AIO parent Project -->
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-and-filter-test-resources</id>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
|
||||
<resources>
|
||||
<testResource>
|
||||
<directory>src/test/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</testResource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- Runs the integration tests, any class that follows naming convention
|
||||
"**/IT*.java", "**/*IT.java", and "**/*ITCase.java" will be considered an integration test -->
|
||||
<plugin>
|
||||
|
@@ -237,34 +237,14 @@
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<testResources>
|
||||
<testResource>
|
||||
<directory>src/test/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</testResource>
|
||||
</testResources>
|
||||
|
||||
<plugins>
|
||||
<!-- Filter the test resource files in the AIO parent project, and do property substitutions.
|
||||
We need this config so this is done before the Alfresco Maven Plugin 'run' is executed. -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>3.0.1</version>
|
||||
<inherited>false</inherited>
|
||||
<!-- Run only for the AIO parent Project -->
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-and-filter-test-resources</id>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>copy-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
|
||||
<resources>
|
||||
<testResource>
|
||||
<directory>src/test/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</testResource>
|
||||
</resources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!--
|
||||
The Alfresco Maven Plugin contains all the logic to run the extension
|
||||
@@ -322,13 +302,6 @@
|
||||
JARs and AMPs that should be overlayed/applied to the Share WAR (i.e. share.war)
|
||||
-->
|
||||
<shareModules>
|
||||
<moduleDependency>
|
||||
<!-- Bring in a newer version of Aikau, can coexist with older versions in the
|
||||
WAR distribution, newest version is picked. -->
|
||||
<groupId>${alfresco.groupId}</groupId>
|
||||
<artifactId>aikau</artifactId>
|
||||
<version>${aikau.version}</version>
|
||||
</moduleDependency>
|
||||
|
||||
<!-- Bring in custom Modules -->
|
||||
<moduleDependency>
|
||||
@@ -361,10 +334,8 @@
|
||||
<fallback>all</fallback>
|
||||
<resources>
|
||||
<resource>
|
||||
<!--
|
||||
Empty resource element marks default configuration. By
|
||||
default it is placed first in generated configuration.
|
||||
-->
|
||||
<directory>${project.build.outputDirectory}</directory>
|
||||
<directory>${project.build.testOutputDirectory}</directory>
|
||||
</resource>
|
||||
</resources>
|
||||
</classpath>
|
||||
|
@@ -0,0 +1,48 @@
|
||||
# Enable hotswap so that changes in this module will be automatically reloaded
|
||||
# Watch for changed class files on watchResources path and reload class definition in the running application.
|
||||
autoHotswap=true
|
||||
#autoHotswap.port=8000
|
||||
|
||||
# Add a directory prior to application classpath (load classes and resources).
|
||||
#
|
||||
# This may be useful for example in multi module maven project to load class changes from upstream project
|
||||
# classes. Set extraClasspath to upstream project compiler output and .class file will have precedence to
|
||||
# classes from built JAR file.
|
||||
# i.e. monitor /target/classes
|
||||
# should work with extraClasspath=${project.build.outputDirectory}
|
||||
# If not try
|
||||
extraClasspath=${project.basedir}/${artifactId}-platform-jar/target/classes;${project.basedir}/${artifactId}-platform-jar/target/test-classes;${project.basedir}/integration-tests/target/classes;${project.basedir}/integration-tests/target/test-classes
|
||||
|
||||
# Comma separated list of disabled plugins
|
||||
# Use plugin name - e.g.
|
||||
# Hotswapper, AnonymousClassPatch, WatchResources, Hibernate, Spring, Jersey2, Jetty, Tomcat,
|
||||
# ZK, Logback, JSF, Seam, ELResolver, OsgiEquinox, Proxy, WebObjects, Weld, JBossModules, Resteasy, Gae
|
||||
disabledPlugins=Hibernate,Spring
|
||||
|
||||
# Add a directory prior to webapp path (load webapp resources).
|
||||
#
|
||||
# Load web application resources (such as HTML, JSP, CSS, ...) from this directory prior to default processing.
|
||||
# Use this setting to set to serve resources from source directory directly (e.g. src/main/webapp).
|
||||
extraWebappContext=${project.basedir}/${artifactId}-platform-jar/target/classes/META-INF/resources;
|
||||
|
||||
# Load static web resources from different directory.
|
||||
#
|
||||
# This setting is dependent on application server plugin(Jetty, Tomcat, JBoss, ...)
|
||||
webappDir=${project.basedir}/${artifactId}-platform-jar/target/classes/META-INF/resources;
|
||||
|
||||
# Watch for changes in a directory (resources only).
|
||||
#
|
||||
# Similar to extraClasspath this property adds classpath when searching for resources (not classes).
|
||||
# While extra classpath just modifies the classloader, this setting does nothing until the resource
|
||||
# is really changed.
|
||||
#
|
||||
# Sometimes it is not possible to point extraClasspath to your i.e. src/main/resources, because there are multiple
|
||||
# replacements of resources in a building step (maven filtering resource option).
|
||||
# This setting will leave i.e. src/target/classes as default source for resources, but after the resource is modified
|
||||
# in src/main/resources, the new changed resource is served instead.
|
||||
# watchResources=
|
||||
|
||||
LOGGER.org.hotswap.agent=DEBUG
|
||||
#LOGGER.org.hotswap.agent.plugin=TRACE
|
||||
#LOGGER.org.hotswap.agent.watch=TRACE
|
||||
#LOGGER.org.hotswap.agent.command=TRACE
|
@@ -0,0 +1,49 @@
|
||||
# Enable hotswap so that changes in this module will be automatically reloaded
|
||||
# Watch for changed class files on watchResources path and reload class definition in the running application.
|
||||
autoHotswap=true
|
||||
#autoHotswap.port=8000
|
||||
|
||||
# Add a directory prior to application classpath (load classes and resources).
|
||||
#
|
||||
# This may be useful for example in multi module maven project to load class changes from upstream project
|
||||
# classes. Set extraClasspath to upstream project compiler output and .class file will have precedence to
|
||||
# classes from built JAR file.
|
||||
# i.e. monitor /target/classes
|
||||
# should work with extraClasspath=${project.build.outputDirectory}
|
||||
# If not try
|
||||
extraClasspath=${project.basedir}/${artifactId}-share-jar/target/classes;${project.basedir}/${artifactId}-share-jar/target/test-classes
|
||||
|
||||
|
||||
# Comma separated list of disabled plugins
|
||||
# Use plugin name - e.g.
|
||||
# Hotswapper, AnonymousClassPatch, WatchResources, Hibernate, Spring, Jersey2, Jetty, Tomcat,
|
||||
# ZK, Logback, JSF, Seam, ELResolver, OsgiEquinox, Proxy, WebObjects, Weld, JBossModules, Resteasy, Gae
|
||||
disabledPlugins=Hibernate,Spring
|
||||
|
||||
# Add a directory prior to webapp path (load webapp resources).
|
||||
#
|
||||
# Load web application resources (such as HTML, JSP, CSS, ...) from this directory prior to default processing.
|
||||
# Use this setting to set to serve resources from source directory directly (e.g. src/main/webapp).
|
||||
extraWebappContext=${project.basedir}/${artifactId}-share-jar/target/classes/META-INF/resources;
|
||||
|
||||
# Load static web resources from different directory.
|
||||
#
|
||||
# This setting is dependent on application server plugin(Jetty, Tomcat, JBoss, ...)
|
||||
webappDir=${project.basedir}/${artifactId}-share-jar/target/classes/META-INF/resources;
|
||||
|
||||
# Watch for changes in a directory (resources only).
|
||||
#
|
||||
# Similar to extraClasspath this property adds classpath when searching for resources (not classes).
|
||||
# While extra classpath just modifies the classloader, this setting does nothing until the resource
|
||||
# is really changed.
|
||||
#
|
||||
# Sometimes it is not possible to point extraClasspath to your i.e. src/main/resources, because there are multiple
|
||||
# replacements of resources in a building step (maven filtering resource option).
|
||||
# This setting will leave i.e. src/target/classes as default source for resources, but after the resource is modified
|
||||
# in src/main/resources, the new changed resource is served instead.
|
||||
# watchResources=
|
||||
|
||||
LOGGER.org.hotswap.agent=DEBUG
|
||||
#LOGGER.org.hotswap.agent.plugin=TRACE
|
||||
#LOGGER.org.hotswap.agent.watch=TRACE
|
||||
#LOGGER.org.hotswap.agent.command=TRACE
|
@@ -21,7 +21,6 @@ import org.alfresco.maven.plugin.config.ModuleDependency;
|
||||
import org.alfresco.maven.plugin.config.TomcatDependency;
|
||||
import org.alfresco.maven.plugin.config.TomcatWebapp;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.net.telnet.TelnetClient;
|
||||
import org.apache.http.client.methods.CloseableHttpResponse;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
@@ -38,10 +37,6 @@ import org.codehaus.plexus.util.FileUtils;
|
||||
import org.zeroturnaround.zip.ZipUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -81,6 +76,9 @@ public abstract class AbstractRunMojo extends AbstractMojo {
|
||||
@Component
|
||||
protected BuildPluginManager pluginManager;
|
||||
|
||||
@Parameter(property = "reactorProjects", required = true, readonly = true)
|
||||
protected List<MavenProject> reactorProjects;
|
||||
|
||||
/**
|
||||
* The following properties that start with 'maven.' are used to control the
|
||||
* Alfresco Maven plugin itself.
|
||||
@@ -148,6 +146,13 @@ public abstract class AbstractRunMojo extends AbstractMojo {
|
||||
@Parameter(property = "maven.alfresco.enablePlatform", defaultValue = "true")
|
||||
protected boolean enablePlatform;
|
||||
|
||||
/**
|
||||
* Enable or disable generation of Hotswap Agent configuration
|
||||
*/
|
||||
@Parameter(property = "maven.alfresco.copyHotswapAgentConfig", defaultValue = "true")
|
||||
protected boolean copyHotswapAgentConfig;
|
||||
|
||||
|
||||
/**
|
||||
* Switch to enable/disable the Share (share.war) when running embedded Tomcat.
|
||||
*/
|
||||
@@ -821,6 +826,40 @@ public abstract class AbstractRunMojo extends AbstractMojo {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copy and Build hotswap-agent.properties
|
||||
*
|
||||
* @throws MojoExecutionException
|
||||
*/
|
||||
protected void copyHotswapAgentProperties(String warPrefix) throws MojoExecutionException {
|
||||
if ( copyHotswapAgentConfig == false ) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String warOutputDir = getWarOutputDir(warPrefix) + "/WEB-INF/classes/";
|
||||
|
||||
|
||||
getLog().info("Copying " + warPrefix + "-hotswap-agent.properties to " + warOutputDir);
|
||||
|
||||
executeMojo(
|
||||
plugin(
|
||||
groupId("com.coderplus.maven.plugins"),
|
||||
artifactId("copy-rename-maven-plugin"),
|
||||
version("1.0")
|
||||
),
|
||||
goal("rename"),
|
||||
configuration(
|
||||
element(name("sourceFile"), project.getBuild().getTestOutputDirectory() + "/" + warPrefix + "-hotswap-agent.properties"),
|
||||
element(name("destinationFile"), warOutputDir + "hotswap-agent.properties")
|
||||
),
|
||||
execEnv
|
||||
);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Build the customized Platform webapp (i.e. the Repository, alfresco.war)
|
||||
* that should be deployed by Tomcat by applying all AMPs and JARs from
|
||||
@@ -832,6 +871,7 @@ public abstract class AbstractRunMojo extends AbstractMojo {
|
||||
|
||||
commentOutSecureCommsInPlatformWebXml();
|
||||
copyAlfrescoLicense();
|
||||
copyHotswapAgentProperties(PLATFORM_WAR_PREFIX_NAME);
|
||||
|
||||
String platformWarArtifactId = packageAndInstallCustomWar(PLATFORM_WAR_PREFIX_NAME);
|
||||
|
||||
@@ -852,6 +892,8 @@ public abstract class AbstractRunMojo extends AbstractMojo {
|
||||
|
||||
copyShareLog4jConfig();
|
||||
copyShareConfigCustom();
|
||||
copyHotswapAgentProperties(SHARE_WAR_PREFIX_NAME);
|
||||
|
||||
|
||||
String shareWarArtifactId = packageAndInstallCustomWar(SHARE_WAR_PREFIX_NAME);
|
||||
|
||||
|
Reference in New Issue
Block a user