Since my hosting provider supports Tomcat/MySQL, I got roller (from trunk)
to build a war that deploys out of the box on Tomcat. Here are the steps I
followed. I hope its useful to others. I had to tweak the pom.xml under the
weblogger-webapp directory and my pom.xml is attached. The differences are
minor and highlighted in the docs.. I checked the instructions a couple of
times and it worked for me on my Ubuntu.

Building and installing roller from trunk but customized for Tomcat/MySQL

Prerequisites : Make sure you have java JDK (I use 1.6) and maven
installed on your box.

1) Check out the top of trunk into a roller directory
svn co https://svn.apache.org/repos/asf/roller/trunk roller



2) Make sure the roller-custom.properties file gets bundled into the
war. Instead of copying the war over into Tomcat's webapps directory
and then exploding it manually, copying jar files and copying the
properties file, I use the following technique to build the final war
directly.

2.a) mkdir -p roller/weblogger-webapp/src/main/resources
2.b) Create the file
roller/weblogger-webapp/src/main/resources/roller-custom.properties
with the following contents (change the username/password based on
what you want to use).
     I have attached my version of the file with this email.

## roller-custom.properties begin
installation.type=auto

database.configurationType=jdbc
database.jdbc.driverClass=com.mysql.jdbc.Driver
database.jdbc.connectionURL=jdbc:mysql://localhost/rollerdb
database.jdbc.username=roller_user
database.jdbc.password=password

mail.configurationType=properties
mail.hostname=localhost
## roller-custom.properties end

2.c) Change the pom.xml file to make mail.jar not a 'provided' jar
(since Tomcat doesnt ship a mail.jar in its distribution and we can
get maven to download it for us), add the mysql-connector.jar as a
dependency . I didnt add activation.jar but usually if you need to
send attachments and stuff in the emails it could be added as well.
(the pom.xml I use is attached along with this email).

        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.11</version>
        </dependency>

2.d) Also change pom.xml to copy over the
src/main/resources/roller-custom.properties into the war (add another
execution element to the executions element under the
maven-resources-plugin (refer to attached pom.xml file)

                  <execution>
                        <id>copy-custom-roller-props</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>

<outputDirectory>${project.build.directory}/roller/WEB-INF/classes/</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/resources</directory>
                                    <filtering>false</filtering>
                                    <includes>
                                        <include>**/*.properties</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>

3) Build the project

cd roller
mvn clean install

4) cp weblogger-webapp/target/roller.war ${TOMCAT_HOME}/webapps

5) Set up your mysql database (in example below we create a database
called rollerdb, with user 'roller_user' and password 'password',
because thats we configured in roller-custom.properties in step 2.b )

$> mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 214
Server version: 5.1.37-1ubuntu5.5 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> create database rollerdb;
Query OK, 1 row affected (0.00 sec)

mysql> grant all on rollerdb.* to 'roller_user'@'%' identified by 'password';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all on rollerdb.* to 'roller_user'@'localhost' identified
by 'password';
Query OK, 0 rows affected (0.00 sec)

mysql> quit;


6) Start tomcat .. and you are good to go if you point your browser to
the 'roller' context.

${TOMCAT_HOME}/bin/startup.sh

Hitting the roller context from your browser will show you a page
where roller prompts you to create database tables, and then you can
register your new user and start blogging :)
<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/xsd/maven-4.0.0.xsd";>

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.apache.roller</groupId>
        <artifactId>roller-project</artifactId>
        <version>5.0.0-RC3</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <name>Apache Roller Weblogger Web Application</name>
    <groupId>org.apache.roller</groupId>
    <artifactId>roller-weblogger-webapp</artifactId>
    <version>5.0.0-RC3</version>
    <packaging>war</packaging>

    <dependencies>

        <dependency>
            <groupId>org.apache.roller</groupId>
            <artifactId>roller-core</artifactId>
            <version>5.0.0-RC3</version>
        </dependency>

        <dependency>
            <groupId>org.apache.roller</groupId>
            <artifactId>roller-planet-business</artifactId>
            <version>5.0.0-RC3</version>
            <exclusions>
                <exclusion>
                    <artifactId>geronimo-jms_1.1_spec</artifactId>
                    <groupId>org.apache.geronimo.specs</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>commons-pool</artifactId>
                    <groupId>commons-pool</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>commons-logging-api</artifactId>
                    <groupId>commons-logging</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.roller</groupId>
            <artifactId>roller-weblogger-business</artifactId>
            <version>5.0.0-RC3</version>
        </dependency>

        <dependency>
            <groupId>org.apache.roller</groupId>
            <artifactId>roller-weblogger-web</artifactId>
            <version>5.0.0-RC3</version>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-spring-plugin</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-beans</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-context</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-tiles-plugin</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>commons-logging-api</artifactId>
                    <groupId>commons-logging</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-jsp</artifactId>
        </dependency>

        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-api</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>commons-logging-api</artifactId>
                    <groupId>commons-logging</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>net.java.dev.rome</groupId>
            <artifactId>rome-propono</artifactId>
            <scope>compile</scope>
        </dependency>

        <!-- Spring Security deps -->

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>2.5.6</version>
            <exclusions>
                <exclusion>
                    <groupId>aopalliance</groupId>
                    <artifactId>aopalliance</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.ldap</groupId>
            <artifactId>spring-ldap</artifactId>
            <version>1.2</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>2.0.5.RELEASE</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-support</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-openid</artifactId>
            <version>2.0.5.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <version>2.0.5.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-acl</artifactId>
            <version>2.0.5.RELEASE</version>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-jdbc</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-dao</artifactId>
            <version>2.0.6</version>
            <exclusions>
                <exclusion>
                    <groupId>aopalliance</groupId>
                    <artifactId>aopalliance</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <!-- OpenID deps -->

        <dependency>
            <groupId>org.openxri</groupId>
            <artifactId>openxri-client</artifactId>
            <version>1.2.0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-jcl</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>jug</groupId>
                    <artifactId>jug</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.openxri</groupId>
            <artifactId>openxri-syntax</artifactId>
            <version>1.2.0</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-jcl</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.ibm.icu</groupId>
                    <artifactId>icu4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.openid4java</groupId>
            <artifactId>openid4java-consumer</artifactId>
            <version>0.9.5</version>
        </dependency>

        <dependency>
            <groupId>net.sf.ehcache</groupId>
            <artifactId>ehcache</artifactId>
            <version>1.6.2</version>
        </dependency>

        <dependency>
            <groupId>xml-security</groupId>
            <artifactId>xmlsec</artifactId>
            <version>1.3.0</version>
        </dependency>

        <dependency>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
            <version>2.9.1</version>
        </dependency>

        <!-- Java EE deps -->

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <!-- <scope>provided</scope> -->
        </dependency>

        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.11</version>
        </dependency>


        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty</artifactId>
            <version>6.1.26</version>
            <scope>provided</scope>
        </dependency>

        <!-- test deps -->

        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>1.2.2</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <artifactId>commons-pool</artifactId>
                    <groupId>commons-pool</groupId>
                </exclusion>
            </exclusions>
        </dependency>


        <dependency>
            <groupId>simple-jndi</groupId>
            <artifactId>simple-jndi</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.roller</groupId>
            <artifactId>test-utils</artifactId>
            <version>5.0.0-RC3</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.derby</groupId>
                    <artifactId>derby</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.derby</groupId>
                    <artifactId>derby</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derbyclient</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>

        <finalName>roller</finalName>

        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.1.1</version>
                <configuration>
                    <archiveClasses>true</archiveClasses>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.mortbay.jetty</groupId>
                <artifactId>maven-jetty-plugin</artifactId>
                <version>6.1.26</version>
                <configuration>
                    <contextPath>roller</contextPath>
                    <jettyConfig>${project.build.directory}/test-classes/jetty.xml</jettyConfig>
                    <build.plugins.plugin.version></build.plugins.plugin.version>
                    <systemProperties>

                        <systemProperty>
                            <name>derby.dir</name>
                            <value>${project.build.directory}/work/derby-system</value>
                        </systemProperty>

                        <systemProperty>
                            <name>config.dir</name>
                            <value>${basedir}/src/test/resources</value>
                        </systemProperty>

                        <systemProperty>
                            <name>jetty.home</name>
                            <value>${basedir}/src/test/resources</value>
                        </systemProperty>

                        <systemProperty>
                            <name>jetty.logs</name>
                            <value>${basedir}/src/test/resources</value>
                        </systemProperty>

                        <systemProperty>
                            <name>derby.port</name>
                            <value>3223</value>
                        </systemProperty>

                        <systemProperty>
                            <name>roller.custom.config</name>
                            <value>${project.build.directory}/test-classes/roller-custom.properties</value>
                        </systemProperty>

                        <systemProperty>
                            <name>planet.custom.config</name>
                            <value>${project.build.directory}/test-classes/planet-custom.properties</value>
                        </systemProperty>

                    </systemProperties>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.roller</groupId>
                        <artifactId>test-utils</artifactId>
                        <version>5.0.0-RC3</version>
                    </dependency>
                    <dependency>
                        <groupId>log4j</groupId>
                        <artifactId>log4j</artifactId>
                        <version>1.2.12</version>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.roller</groupId>
                        <artifactId>test-utils</artifactId>
                        <version>5.0.0-RC3</version>
                    </dependency>
                    
                    <dependency>
                        <groupId>org.apache.derby</groupId>
                        <artifactId>derby</artifactId>
                        <version>${derby.version}</version>
                    </dependency>

                    <dependency>
                        <groupId>org.apache.derby</groupId>
                        <artifactId>derbynet</artifactId>
                        <version>${derby.version}</version>
                    </dependency>

                    <dependency>
                        <groupId>org.apache.derby</groupId>
                        <artifactId>derbyclient</artifactId>
                        <version>${derby.version}</version>
                    </dependency>                    
                </dependencies>
            </plugin>

            <!-- <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>

                    <execution>
                        <id>copy-test-properties</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/testsetup</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/test/resources</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>

                    <execution>
                        <id>copy-test-config</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/test/resources</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>

                </executions>
                <configuration>
                    <includeEmptyDirs>true</includeEmptyDirs>
                </configuration>
            </plugin> -->

            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>

                    <!-- Ensure tests will run even if 'openjpa' profile not active -->
                    <forkMode>once</forkMode>
                    <argLine>-javaagent:${user.home}/.m2/repository/org/apache/openjpa/openjpa/2.0.0/openjpa-2.0.0.jar</argLine>
                    
                    <systemProperties>
                        <property>
                            <name>catalina.base</name>
                            <value>${project.build.testOutputDirectory}</value>
                        </property>
                        <property>
                            <name>context.realpath</name>
                            <value>${project.basedir}/src/main/webapp</value>
                        </property>
                        <property>
                            <name>project.build.directory</name>
                            <value>${project.build.directory}</value>
                        </property>
                    </systemProperties>
                    <excludes>
                        <exclude>**/TestUtils.java</exclude>
                        <exclude>**/TestTask.java</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.roller</groupId>
                        <artifactId>test-utils</artifactId>
                        <version>${roller.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.derby</groupId>
                        <artifactId>derby</artifactId>
                        <version>${derby.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.derby</groupId>
                        <artifactId>derbynet</artifactId>
                        <version>${derby.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.apache.derby</groupId>
                        <artifactId>derbyclient</artifactId>
                        <version>${derby.version}</version>
                    </dependency>
                </dependencies>

                <executions>

                    <execution>
                        <id>startdb</id>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <!-- Derby only for unit testing: skip when maven.text.skip is set -->
                                <delete dir="${project.build.directory}/derby-system" verbose="true" failonerror="false" />
                                <taskdef name="startdb" classname="org.apache.roller.weblogger.ant.StartDerbyTask"
                                         classpathref="maven.test.classpath"/>
                                <startdb databaseDir="${project.build.directory}/derby-system"
                                         port="3223"
                                         databaseScriptsDir="${project.build.directory}/roller/WEB-INF/classes/dbscripts"
                                         skip="${maven.test.skip}" >
                                </startdb>
                            </tasks>
                        </configuration>
                    </execution>

                    <execution>
                        <id>stopdb</id>
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <!-- Derby only for unit testing: skip when maven.text.skip is set -->
                                <taskdef name="stopdb" classname="org.apache.roller.weblogger.ant.StopDerbyTask"
                                         classpathref="maven.test.classpath"/>
                                <stopdb databaseDir="${project.build.directory}/derby-system"
                                        port="3223"
                                        databaseScriptsDir="${project.build.directory}/roller/WEB-INF/classes/dbscripts"
                                        skip="${maven.test.skip}" >
                                </stopdb>
                                <delete dir="${project.build.directory}/derby-system" verbose="true" failonerror="false" />
                            </tasks>
                        </configuration>
                    </execution>

                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.4.1</version>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/roller/WEB-INF/classes/dbscripts</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>../weblogger-business/target/dbscripts</directory>
                                    <filtering>false</filtering>
                                    <includes>
                                        <include>**/*.sql</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-custom-roller-props</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/roller/WEB-INF/classes/</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/resources</directory>
                                    <filtering>false</filtering>
                                    <includes>
                                        <include>**/*.properties</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>

                </executions>
            </plugin>
            
        </plugins>

        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
            </testResource>
        </testResources>

        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>

    </build>

</project>

Reply via email to