fixes issue #200

fixes issue #213

- refactored solr pom to properly be a WAR project (no more POM)
- removed ANTRUN for good. using maven-war-plugin to pacakge a proper
solr customized war
- added packaging of the -config.zip customized artifact for solr
- updated archetypes to include the new files
- updated runner configuration to run also solr as webapp
- added root webapp with index.html so that opening localhost:8080
points easily to the installed webapps
- aded context for solr
- fixed Solr INFO logging by adding delegate=false in the
context-solr.xml so that slf4j is NOT duplicated
- minor naming updates
This commit is contained in:
mindthegab 2014-09-08 20:31:43 -04:00
parent 65414648c8
commit 561aa10ff7
6 changed files with 262 additions and 175 deletions

View File

@ -127,6 +127,12 @@
<include>**</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8" filtered="false">
<directory>src/assembly</directory>
<includes>
<include>**</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8" filtered="false">
<directory>src/main/resources</directory>
<includes>
@ -160,6 +166,12 @@
<include>**</include>
</includes>
</fileSet>
<fileSet encoding="UTF-8" filtered="false">
<directory>src/main/webapp</directory>
<includes>
<include>**</include>
</includes>
</fileSet>
</fileSets>
</module>
</modules>

View File

@ -15,10 +15,6 @@
<profiles>
<profile>
<id>run</id>
<properties>
<!-- Location of the Solr project, which is loaded via filesystem. Change if your Solr customization project lives in a different folder. -->
<solr.project.dir>${project.basedir}/../solr</solr.project.dir>
</properties>
<build>
<plugins>
<plugin>
@ -56,17 +52,22 @@
</execution>
</executions>
<configuration>
<warSourceDirectory>${project.parent.basedir}/solr/target/solr-overlay</warSourceDirectory>
<path>/solr</path>
<useTestClasspath>false</useTestClasspath>
<ignorePackaging>true</ignorePackaging>
<useSeparateTomcatClassLoader>true</useSeparateTomcatClassLoader>
<path>/</path>
<systemProperties>
<solr.solr.home>${project.parent.basedir}/solr/solr_home</solr.solr.home>
<java.io.tmpdir>${project.build.directory}</java.io.tmpdir>
</systemProperties>
<delegate>true</delegate>
<webapps>
<webapp>
<groupId>${project.groupId}</groupId>
<artifactId>solr</artifactId>
<version>${project.version}</version>
<type>war</type>
<asWebapp>true</asWebapp>
<contextPath>/solr</contextPath>
<contextFile>${project.build.directory}/contexts/context-solr.xml</contextFile>
</webapp>
<webapp>
<groupId>${project.groupId}</groupId>
<artifactId>repo</artifactId>
@ -92,4 +93,5 @@
</build>
</profile>
</profiles>
</project>

View File

@ -0,0 +1,22 @@
<html>
<head>
<title>Alfresco SDK 2.x - Running Alfresco ${alfresco.version}</title>
</head>
<body style="font: 13px/1.231 Open Sans,arial,helvetica,clean,sans-serif;">
<img alt="Maven Alfresco SDK" src="https://github.com/Alfresco/alfresco-sdk/raw/master/src/site/resources/img/alfresco-maven-logo.jpg">
<p>Welcome to the <a href="https://github.com/Alfresco/alfresco-sdk/">Alfresco SDK</a> powered by Apache Maven! You can access the Alfresco components running embedded below:</p>
<ul>
<li><a href="/share">Alfresco Share</a></li>
<li><a href="/alfresco">Alfresco Repository</a></li>
<li><a href="/solr">Alfresco Solr</a></li>
</ul>
<p><b>Resources:</b></p>
<ul>
<li><a href="http://docs.alfresco.com">Alfresco Docs</a></li>
<li><a href="https://github.com/Alfresco/alfresco-sdk/fork">Fork this SDK!</a></li>
<li><a href="https://issues.alfresco.com/jira/browse/ALF">Report an Alfresco issue</a></li>
<li><a href="https://github.com/Alfresco/alfresco-sdk/issues/new">Report an SDK issue</a></li>
</ul>
</body>
</html>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- This context file is used only for rapid development, never installed released with the webapp -->
<Context docBase="${project.parent.basedir}/solr/target/solr">
<Loader delegate="false" className="org.apache.catalina.loader.VirtualWebappLoader"
searchVirtualFirst="true"
virtualClasspath="${project.parent.basedir}/share-amp/target/classes;${project.parent.basedir}/solr/target/test-classes;${project.parent.basedir}/solr/target/share-amp/config" />
<!-- This enables hot reloading of web resources from uncompressed jars (while in prod they would be loaded from WEB-INF/lib/{\*.jar}/META-INF/resources -->
<JarScanner scanAllDirectories="true" />
</Context>

View File

@ -2,8 +2,8 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>${artifactId}</artifactId>
<name>Alfresco Apache Solr Customization Module</name>
<packaging>pom</packaging>
<name>Alfresco Apache Solr Customization Project</name>
<packaging>war</packaging>
<description>Alfresco Apache Solr Customization</description>
<parent>
@ -12,171 +12,191 @@
<version>${version}</version>
</parent>
<properties>
<alfresco.solr.dir>${project.basedir}/solr_home</alfresco.solr.dir>
<alfresco.solr.war.overlay>${project.build.directory}/${project.artifactId}-overlay</alfresco.solr.war.overlay>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-alfresco-community-lib</id>
<goals><goal>unpack</goal></goals>
<phase>generate-resources</phase>
<configuration>
<outputDirectory>${alfresco.solr.dir}</outputDirectory>
<artifactItems>
<artifactItem>
<artifactId>alfresco-solr</artifactId>
<groupId>${alfresco.groupId}</groupId>
<classifier>config</classifier>
<version>${alfresco.version}</version>
<type>zip</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<execution>
<id>copy-alfresco-solr</id>
<goals><goal>unpack</goal></goals>
<phase>generate-resources</phase>
<configuration>
<outputDirectory>${alfresco.solr.war.overlay}</outputDirectory>
<artifactItems>
<artifactItem>
<artifactId>alfresco-solr</artifactId>
<groupId>${alfresco.groupId}</groupId>
<version>${alfresco.version}</version>
<type>war</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<!-- The folder where the solr.home directory will be created. NOTE: this doesn't get cleaned by mvn clean, you need to invoke -Ppurge to clean this folder or remove it manually -->
<properties>
<alfresco.solr.dir>${project.basedir}/solr_home</alfresco.solr.dir>
</properties>
</executions>
</plugin>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<!-- Copies overridden / custom configurations to solr -->
<executions>
<execution>
<id>copy-solr-properties</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${alfresco.solr.dir}</outputDirectory>
<resources>
<resource>
<directory>src/main/solr-properties/archive</directory>
<filtering>true</filtering>
<targetPath>${alfresco.solr.dir}/archive-SpacesStore/conf</targetPath>
</resource>
<resource>
<directory>src/main/solr-properties/workspace</directory>
<filtering>true</filtering>
<targetPath>${alfresco.solr.dir}/workspace-SpacesStore/conf</targetPath>
</resource>
<resource>
<directory>src/main/solr-properties</directory>
<filtering>true</filtering>
<includes>
<include>log4j-solr.properties</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<!-- Allows packaging of solr-home in a zip package with the 'config' classifier -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assembly/solr-config-assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
<!-- Replaces web.xml where applicable, commenting out the security-constraints -->
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<executions>
<execution>
<id>disable-securecomms</id>
<phase>process-resources</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<ignoreErrors>true</ignoreErrors>
<file>${alfresco.solr.war.overlay}/WEB-INF/web.xml</file>
<replacements>
<replacement>
<token><![CDATA[<!-- <security-constraint>]]></token>
<value><![CDATA[<security-constraint>]]></value>
</replacement>
<replacement>
<token><![CDATA[</security-role> -->]]></token>
<value><![CDATA[</security-role>]]></value>
</replacement>
<replacement>
<token><![CDATA[<security-constraint>]]></token>
<value><![CDATA[<!-- <security-constraint>]]></value>
</replacement>
<replacement>
<token><![CDATA[</security-role>]]></token>
<value><![CDATA[</security-role> -->]]></value>
</replacement>
</replacements>
</configuration>
</plugin>
</executions>
</plugin>
</plugins>
</build>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>create-solr-war</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="Packaging Apache Solr WAR overlay" />
<zip basedir="${alfresco.solr.war.overlay}" destfile="${alfresco.solr.dir}/apache-solr-1.4.1-overlay.war" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
<dependencies>
<!-- The solr war -->
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-solr</artifactId>
<version>${alfresco.version}</version>
<type>war</type>
</dependency>
<!-- The Alfresco solr classes for compilation purposes -->
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-solr</artifactId>
<version>${alfresco.version}</version>
<classifier>classes</classifier>
<type>jar</type>
<scope>provided</scope>
</dependency>
<!-- The Zipped solr.home default configuration -->
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-solr</artifactId>
<classifier>config</classifier>
<version>${alfresco.version}</version>
<type>zip</type>
</dependency>
</dependencies>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>overlay-web-xml</id>
<phase>generate-resources</phase>
<goals><goal>copy-resources</goal></goals>
<configuration>
<outputDirectory>${alfresco.solr.war.overlay}/WEB-INF</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<targetPath>classes</targetPath>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-solr-resources</id>
<phase>package</phase>
<goals><goal>copy-resources</goal></goals>
<configuration>
<outputDirectory>${alfresco.solr.dir}</outputDirectory>
<resources>
<resource>
<directory>src/main/solr-properties/archive</directory>
<filtering>true</filtering>
<targetPath>${alfresco.solr.dir}/archive-SpacesStore/conf</targetPath>
</resource>
<resource>
<directory>src/main/solr-properties/workspace</directory>
<filtering>true</filtering>
<targetPath>${alfresco.solr.dir}/workspace-SpacesStore/conf</targetPath>
</resource>
<resource>
<directory>src/main/solr-properties</directory>
<filtering>true</filtering>
<includes>
<include>log4j-solr.properties</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-solr</artifactId>
<classifier>config</classifier>
<version>${alfresco.version}</version>
<type>zip</type>
</dependency>
</dependencies>
<!-- Performs operations needed to run solr embedded (e.g. disable HTTPs) -->
<profiles>
<profile>
<id>run</id>
<properties>
<app.solr.patches.folder>${project.build.directory}/${project.build.finalName}-patches</app.solr.patches.folder>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-alfresco-config</id>
<goals>
<goal>unpack</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<outputDirectory>${alfresco.solr.dir}</outputDirectory>
<artifactItems>
<artifactItem>
<artifactId>alfresco-solr</artifactId>
<groupId>${alfresco.groupId}</groupId>
<classifier>config</classifier>
<version>${alfresco.version}</version>
<type>zip</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<id>unpack-solr-war</id>
<phase>prepare-package</phase>
<goals>
<goal>exploded</goal>
</goals>
</execution>
<execution>
<id>default-war</id>
<configuration>
<webXml>${app.solr.patches.folder}/WEB-INF/web.xml</webXml>
</configuration>
</execution>
</executions>
</plugin>
<!-- Replaces web.xml where applicable, commenting out the security-constraints -->
<plugin>
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
<executions>
<execution>
<id>disable-securecomms</id>
<phase>prepare-package</phase>
<goals>
<goal>replace</goal>
</goals>
</execution>
</executions>
<configuration>
<file>${project.build.directory}/${project.build.finalName}/WEB-INF/web.xml</file>
<outputDir>${app.solr.patches.folder}/WEB-INF</outputDir>
<preserveDir>false</preserveDir>
<replacements>
<replacement>
<token><![CDATA[<!-- <security-constraint>]]></token>
<value><![CDATA[<security-constraint>]]></value>
</replacement>
<replacement>
<token><![CDATA[</security-role> -->]]></token>
<value><![CDATA[</security-role>]]></value>
</replacement>
<replacement>
<token><![CDATA[<security-constraint>]]></token>
<value><![CDATA[<!-- <security-constraint>]]></value>
</replacement>
<replacement>
<token><![CDATA[</security-role>]]></token>
<value><![CDATA[</security-role> -->]]></value>
</replacement>
</replacements>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -0,0 +1,19 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>config</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${project.basedir}/solr_home</directory>
<!-- Excludes data -->
<excludes>
<exclude>archive/**</exclude>
<exclude>workspace/**</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>