diff --git a/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/src/test/resources/share/share-config-custom.xml b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/src/test/resources/share/share-config-custom.xml
new file mode 100644
index 00000000..8c776cae
--- /dev/null
+++ b/archetypes/alfresco-allinone-archetype/src/main/resources/archetype-resources/src/test/resources/share/share-config-custom.xml
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+ production
+
+
+
+ false
+
+
+
+
+
+
+
+
+ true
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+ alfresco-noauth
+ Alfresco - unauthenticated access
+ Access to Alfresco Repository WebScripts that do not require authentication
+ alfresco
+ ${alfresco.repo.url}/s
+ none
+
+
+
+ alfresco
+ Alfresco - user access
+ Access to Alfresco Repository WebScripts that require user authentication
+ alfresco
+ ${alfresco.repo.url}/s
+ user
+
+
+
+ alfresco-feed
+ Alfresco Feed
+ Alfresco Feed - supports basic HTTP authentication via the EndPointProxyServlet
+ http
+ ${alfresco.repo.url}/s
+ true
+ user
+
+
+
+ activiti-admin
+ Activiti Admin UI - user access
+ Access to Activiti Admin UI, that requires user authentication
+ activiti-admin-connector
+ ${alfresco.repo.url}/activiti-admin
+ user
+
+
+
+ alfresco-api
+ alfresco
+ Alfresco Public API - user access
+ Access to Alfresco Repository Public API that require user authentication.
+ This makes use of the authentication that is provided by parent 'alfresco' endpoint.
+ alfresco
+ ${alfresco.repo.url}/alfresco/api
+ user
+
+
+
+
+
diff --git a/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/AbstractRunMojo.java b/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/AbstractRunMojo.java
index 903c69b2..6d099a08 100644
--- a/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/AbstractRunMojo.java
+++ b/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/AbstractRunMojo.java
@@ -263,6 +263,19 @@ public abstract class AbstractRunMojo extends AbstractMojo {
@Parameter(property = "maven.alfresco.tomcat.custom.webapps", defaultValue = "")
protected List tomcatCustomWebapps;
+ /**
+ * Port to run Tomcat on
+ */
+ @Parameter(property = "maven.alfresco.tomcat.port", defaultValue = "8080")
+ protected String tomcatPort;
+
+ /**
+ * Legacy to be compatible with maven.tomcat.port
+ */
+ @Parameter(property = "maven.tomcat.port", defaultValue = "8080")
+ protected String mavenTomcatPort;
+
+
/**
* Maven GAV properties for standard Alfresco web applications.
*/
@@ -326,6 +339,20 @@ public abstract class AbstractRunMojo extends AbstractMojo {
*/
protected ExecutionEnvironment execEnv;
+ /**
+ * 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
+ */
+ protected String getPort() {
+ String port = tomcatPort;
+ if (mavenTomcatPort.toString() != tomcatPort.toString()) {
+ port = mavenTomcatPort;
+ getLog().info( "Tomcat Port overridden by property maven.tomcat.port");
+ }
+
+ return port;
+ }
+
/**
* Download and unpack the Solr 4 configuration as we don't have it in the project.
* It will reside under /alf_data_dev/solr
@@ -411,7 +438,12 @@ public abstract class AbstractRunMojo extends AbstractMojo {
element(name("replacement"),
element(name("token"), "@@ALFRESCO_SOLR4_DATA_DIR@@"),
element(name("value"), "${solrDataDir}/index")
+ ),
+ element(name("replacement"),
+ element(name("token"), "alfresco.port=8080"),
+ element(name("value"), "alfresco.port=" + getPort())
)
+
)
),
execEnv
@@ -523,6 +555,36 @@ public abstract class AbstractRunMojo extends AbstractMojo {
),
execEnv
);
+
+ executeMojo(
+ plugin(
+ groupId("com.google.code.maven-replacer-plugin"),
+ artifactId("replacer"),
+ version(MAVEN_REPLACER_PLUGIN_VERSION)
+ ),
+ goal("replace"),
+ configuration(
+ element(name("regex"), "false"),
+ element(name("includes"),
+ element(name("include"), "${project.build.testOutputDirectory}/*.properties")
+ ),
+ element(name("replacements"),
+ element(name("replacement"),
+ element(name("token"), "alfresco.port=8080"),
+ element(name("value"), "alfresco.port=" + getPort())
+ ),
+ element(name("replacement"),
+ element(name("token"), "share.port=8080"),
+ element(name("value"), "share.port=" + getPort())
+ ),
+ element(name("replacement"),
+ element(name("token"), "solr.port=8080"),
+ element(name("value"), "solr.port=" + getPort())
+ )
+ )
+ ),
+ execEnv
+ );
}
/**
@@ -647,6 +709,46 @@ public abstract class AbstractRunMojo extends AbstractMojo {
);
}
+
+ /**
+ * Copy Share Config Custom in order to have global overrides for development and dynamic port
+ *
+ * @throws MojoExecutionException
+ */
+ protected void copyShareConfigCustom() throws MojoExecutionException {
+ final String warOutputDir = getWarOutputDir(SHARE_WAR_PREFIX_NAME);
+ final String distDir = warOutputDir + "/WEB-INF/classes/alfresco/web-extension/";
+ String repoUrl = project.getProperties().getProperty("alfresco.repo.url");
+ if (repoUrl == null) {
+ project.getProperties().setProperty("alfresco.repo.url", "http://localhost:" + getPort() + "/alfresco");
+ }
+
+ getLog().info("Copying Share config custom to: " + distDir);
+
+ executeMojo(
+ plugin(
+ groupId("org.apache.maven.plugins"),
+ artifactId("maven-resources-plugin"),
+ version(MAVEN_RESOURCE_PLUGIN_VERSION)
+ ),
+ goal("copy-resources"),
+ configuration(
+ element(name("outputDirectory"), distDir),
+ element(name("resources"),
+ element(name("resource"),
+ element(name("directory"), "src/test/resources/share"),
+ element(name("includes"),
+ element(name("include"), "*.xml")
+ ),
+ element(name("filtering"), "true")
+ )
+ )
+ ),
+ execEnv
+ );
+ }
+
+
/**
* Copy a custom Share Log4J config into the share-war/WEB-INF/classes dir.
* There is no custom classpath resolve mechanism for Share log4j,
@@ -718,6 +820,7 @@ public abstract class AbstractRunMojo extends AbstractMojo {
alfrescoGroupId, alfrescoShareWarArtifactId, alfrescoShareVersion);
copyShareLog4jConfig();
+ copyShareConfigCustom();
String shareWarArtifactId = packageAndInstallCustomWar(SHARE_WAR_PREFIX_NAME);
@@ -1070,6 +1173,11 @@ public abstract class AbstractRunMojo extends AbstractMojo {
configuration(
element(name("fork"), fork ? "true" : "false"),
+ /*
+ * Port
+ */
+ element(name( "port" ), getPort()),
+
/*
* SDK Projects doesn't have packaging set to 'war', they are JARs or POMs,
* this setting ignores that fact.
diff --git a/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/IntegrationTestMojo.java b/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/IntegrationTestMojo.java
index e23e9e68..2c7c7d92 100644
--- a/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/IntegrationTestMojo.java
+++ b/plugins/alfresco-maven-plugin/src/main/java/org/alfresco/maven/plugin/IntegrationTestMojo.java
@@ -81,6 +81,8 @@ public class IntegrationTestMojo extends AbstractRunMojo {
// execEnv.getMavenSession().getGoals().add("alfresco:it");
+ getLog().info("Checking if Tomcat is already running on port " + "");
+
if (enableSolr) {
unpackSolrConfig();
fixSolrHomePath();