Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Building

...

and

...

deploying

...

Roller

...

from

...

source

...

Build

...

and

...

deploying

...

Roller

...

from

...

source

...

involves

...

three

...

simple

...

steps:

...

get

...

the

...

source,

...

run

...

the

...

build

...

script,

...

follow

...

the

...

installation

...

instructions

...

above

...

to

...

deploy

...

the

...

results.

...

Get

...

the

...

Roller

...

source code

Read the instructions on Roller Source Code Access to find out how to get the source packages for a release or to get the latest source code directly from the source repository.

Example: get very latest Roller source into a directory called roller_trunk

No Format
 code [#1]

Read the instructions on [Roller Source Code Access|RollerSourceCodeAccess] to find out how to get the source packages for a release or to get the latest source code directly from the source repository. 

   Example: get very latest Roller source into a directory called roller_trunk
{noformat}
   % svn checkout https://svn.apache.org/repos/asf/incubator/roller roller/trunk roller_trunk
{noformat}

After

...

you

...

are

...

done

...

getting

...

the

...

source

...

code,

...

you

...

can

...

return

...

here

...

and

...

move

...

on

...

to

...

Step

...

2.

Run the build

Once you have extracted the Roller source code into a directory on your system, then open up a command prompt and cd to that directory. Set the environment variable JAVA_HOME to point to your JDK and then build Roller by using either the UNIX or Windows version of the build script. This script sets up the right classpath and calls Roller's Ant build script build.xml. The build shell script invokes the Ant that is in the tools subdirectory that comes with the Roller Subversion tree (or from extracting the tools file you downloaded). If you like to drive Ant from your IDE, you should set up to use the same Ant jar and classpath that is used by the shell script.

On UNIX:

No Format



h3. Run the build

Once you have extracted the Roller source code into a directory on your system, then open up a command prompt and __cd__ to that directory. Set the environment variable ''JAVA_HOME'' to point to your JDK and then build Roller by using either the UNIX or Windows version of the build script. This script sets up the right classpath and calls Roller's Ant build script __build.xml__.  The {{build}} shell script invokes the Ant that is in the {{tools}} subdirectory that comes with the Roller Subversion tree (or from extracting the tools file you downloaded).  If you like to drive Ant from your IDE, you should set up to use the same Ant jar and classpath that is used by the shell script.

   On UNIX:
{noformat}
   % chmod +x build.sh
   % build.sh all
{noformat}

   On 

On Windows:

{
No Format
}
   C> build all
{noformat}

This

...

will

...

build

...

Roller

...

and

...

will

...

stage

...

the

...

Roller

...

web

...

application

...

into

...

the

...

build/roller

...

subdirectory.

...

The

...

build

...

subdirectory

...

can

...

be

...

removed

...

for

...

a

...

clean

...

build

...

by

...

specifying

...

the

...

Ant

...

target

...

clean

...

.

...

Examine

...

the

...

build.xml

...

file

...

for

...

additional

...

targets.

Deploy

You can simply copy the build/roller to your tomcat/webapps directory and follow the InstallationGuide to complete your deployment.

If you have problems making a build then please consult with the experts on the roller-dev mailing list. Somebody has probably encountered the very same problems that you are encountering.

After you have deployed Roller at least once manually, if you plan to do continued development, you will probably want to set up ant-based deployment to your test environment.

Running Unit Tests

Currently, unit tests run using mock contexts and use HSQLDB for the test database. They do not require actual container deployment, and can be run as soon as you have completed a full build. To run the tests, use the Ant target "tests". Using the build script this is invoked by running

No Format
 


h3. Deploy [#3]

You can simply copy the ''build/roller'' to your ''tomcat/webapps'' directory and follow the InstallationGuide to complete your deployment.

If you have problems making a build then please consult with the experts on the [roller-dev mailing list|RollerMailingLists]. Somebody has probably encountered the very same problems that you are encountering.

After you have deployed Roller at least once manually, if you plan to do continued development, you will probably want to set up ant-based deployment to your test environment [5].


h3. Running Unit Tests [#4]

Currently, unit tests run using mock contexts and use HSQLDB for the test database.  They do not require actual container deployment, and can be run as soon as you have completed a full build.  To run the tests, use the Ant target "tests".  Using the {{build}} script this is invoked by running

{noformat}
   % build.sh tests
{

or

No Format
noformat}

or

{noformat}
   C> build tests
{noformat}

This

...

will

...

leave

...

HTML

...

test

...

reports

...

in

...

files

...

in

...

directories

...

under

...

build/reports

...

.

The ant target clean-tests

...

will

...

remove

...

test

...

build

...

artifacts,

...

test

...

results,

...

and

...

the

...

reports.

...

Running

...

unit

...

tests

...

in

...

the

...

Netbeans

...

debugger

...

You

...

can

...

also

...

run

...

individual

...

JUnit

...

tests

...

within

...

your

...

IDE.

...

There

...

are

...

also

...

two

...

test

...

suite's

...

you

...

can

...

run:

...

org.roller.business.TestAll

...

for

...

the

...

Roller

...

backend

...

and

...

org.roller.presentation.TestAll

...

for

...

the

...

Roller

...

backend.

...

You

...

should

...

have

...

no

...

problem

...

running

...

the

...

'tests'

...

Ant

...

target

...

within

...

Netbeans,

...

but

...

if

...

you

...

want

...

to

...

run

...

individual

...

tests

...

some

...

additional

...

setup

...

is

...

required

...

(TBD:

...

document

...

changes,

...

if

...

any,

...

to

...

project.xml)

...

Running

...

unit

...

tests

...

in

...

the

...

Eclipse

...

debugger

...

The

...

same

...

goes

...

for

...

Eclipse.

...

You

...

can

...

easily

...

run

...

individual

...

unit

...

tests

...

in

...

the

...

Eclipse

...

debugger,

...

just

...

make

...

sure

...

you

...

include

...

the

...

build/tests

...

directory

...

in

...

the

...

debug

...

classpath.

...

See

...

the

...

notes

...

below

...

for

...

setting

...

up

...

the

...

Roller

...

build's

...

built-in

...

HSQLDB

...

database

...

to

...

test

...

against.

...

The

...

Roller

...

build's

...

built-in

...

HSQLDB

...

database

...

If

...

you

...

run

...

the

...

'tests'

...

target,

...

the

...

Roller

...

build

...

script

...

starts

...

an

...

HSQLDB

...

database,

...

creates

...

the

...

Roller

...

database

...

tables,

...

runs

...

the

...

tests

...

and

...

then

...

stops

...

the

...

database.

...

If

...

you

...

want

...

to

...

run

...

individual

...

tests

...

from

...

within

...

an

...

IDE

...

(for

...

example),

...

you'll

...

need

...

to:

...

start

...

and

...

init

...

the

...

database

...

before

...

you

...

run

...

the

...

tests

...

and

...

stop

...

it

...

when

...

you're

...

done.

...

Use

...

these

...

Ant

...

targets

...

to

...

do

...

that:

...

  • start-hsqldb:

...

  • start

...

  • the

...

  • HSQLDB

...

  • database

...

  • (you

...

  • should

...

  • background

...

  • it

...

  • or

...

  • run

...

  • it

...

  • in

...

  • a

...

  • separate

...

  • window).

...

  • init-hsqldb:

...

  • drop

...

  • and

...

  • create

...

  • all

...

  • of

...

  • the

...

  • Roller

...

  • tables

...

  • (assumes

...

  • HSQLDB

...

  • is

...

  • running)

...

  • stop-hsqldb:

...

  • stop

...

  • the

...

  • HSQLDB

...

  • database

...

Ant-based

...

Deployment

...

There

...

are

...

some

...

Ant

...

targets

...

to

...

support

...

the

...

repeated

...

deployment

...

that

...

occurs

...

for

...

developer

...

testing.

...

These

...

are

...

not

...

intended

...

to

...

be

...

used

...

for

...

production

...

deployment.

...

This

...

section

...

describes

...

how

...

to

...

set

...

up

...

the

...

deploy-tomcat

...

target.

...

Using

...

the

...

deploy-tomcat

...

target

...

The

...

deploy-tomcat

...

target

...

will

...

copy

...

the

...

webapp

...

files

...

from

...

your

...

build

...

staging

...

directory

...

to

...

the

...

webapps

...

subdirectory

...

of

...

your

...

Tomcat

...

catalina.home

...

.

...

It

...

does

...

not

...

set

...

up

...

the

...

Tomcat

...

context

...

(e.g.

...

roller.xml)

...

or

...

server.xml

...

files

...

for

...

you.

...

You

...

must

...

do

...

this

...

once

...

manually.

...


To

...

setup

...

to

...

use

...

the

...

deploy-tomcat

...

target,

...

perform

...

the

...

following

...

steps:

...

  1. Copy personal/sample.build.xml

...

  1. to

...

  1. personal/build.xml

...

  1. .

...

  1. You

...

  1. may

...

  1. wish

...

  1. to

...

  1. edit

...

  1. the

...

  1. deploy-tomcat

...

  1. target

...

  1. that

...

  1. is

...

  1. within

...

  1. that.

...

  1. For

...

  1. my

...

  1. needs,

...

  1. I

...

  1. was

...

  1. able

...

  1. to

...

  1. just

...

  1. use

...

  1. the

...

  1. sample

...

  1. version

...

  1. verbatim.

...

  1. This

...

  1. target

...

  1. gets

...

  1. invoked

...

  1. by

...

  1. the

...

  1. deploy-tomcat

...

  1. target

...

  1. that

...

  1. is

...

  1. in

...

  1. the

...

  1. top-level

...

  1. build.xml.

...

  1. Edit

...

  1. the

...

  1. ant.properties

...

  1. file

...

  1. at

...

  1. the

...

  1. top-level

...

  1. of

...

  1. the

...

  1. Roller

...

  1. tree.

...

  1. Make

...

  1. sure

...

  1. that

...

  1. the

...

  1. following

...

  1. properties

...

  1. are

...

  1. defined:

...


  1. ;

...

  1. staging

...

  1. :The

...

  1. directory

...

  1. from

...

  1. which

...

  1. you

...

  1. wish

...

  1. to

...

  1. deploy.

...

  1. Generally

...

  1. the

...

  1. value

...

  1. of

...

  1. this

...

  1. should

...

  1. be

...

  1. "../build/roller"

...


  1. ;

...

  1. webapp.name

...

  1. :The

...

  1. deployed

...

  1. webapp

...

  1. name.

...

  1. Typically

...

  1. this

...

  1. value

...

  1. is

...

  1. "roller".

...

  1. If

...

  1. you

...

  1. change

...

  1. it,

...

  1. make

...

  1. sure

...

  1. the

...

  1. names

...

  1. in

...

  1. your

...

  1. context

...

  1. descriptor,

...

  1. and

...

  1. the

...

  1. filename

...

  1. of

...

  1. the

...

  1. context

...

  1. descriptor

...

  1. agree.

...


  1. ;

...

  1. catalina.home

...

  1. :Your

...

  1. catalina

...

  1. home

...

  1. directory.

...

  1. The

...

  1. Ant

...

  1. script

...

  1. assumes

...

  1. your

...

  1. web

...

  1. apps

...

  1. are

...

  1. deployed

...

  1. to

...

  1. webapps

...

  1. under

...

  1. this

...

  1. directory.

...

You

...

should

...

now

...

be

...

able

...

to

...

execute

...

the

...

deploy-tomcat

...

Ant

...

target

...

that

...

is

...

in

...

the

...

top-level

...

build.xml

...

.

Create and maintain a customized build

The main Ant build file (build.xml) pulls in XML fragment files (.xmlf extension) from the custom subdirectory that can be modified to customize the build process. One technique of maintaining a custom build is to keep your own version of the custom subdirectory in your own revision control system.

To build Roller with your customizations, checkout the desired version of Roller, rename the custom directory to custom.orig, and create a symbolic link to your custom directory, as follows:

  1. svn co $ROLLERSVN roller-2.1
  2. cvs -d $YOURCVS co $YOURROLLERCUSTOM
  3. cd roller-2.1
  4. mv custom custom.orig
  5. ln -s ../$YOURROLLERCUSTOM custom
  6. ./build.sh rebuild

This technique has been used to make changes to JSPs, velocity macros, themes, images, and "small bits" of code. The .xmlf files in the default custom directory provide examples of customizations you can use. (Note: You'll need a solid understanding of Apache Ant to make these kind of changes.)