This is a brief guide to building Tapestry itself from source code.
Prerequisites
- Install a Java JDK (Sun/Oracle, not OpenJDK). 1.5 will work (but 1.6 or newer is recommended).
- Install an IDE (IDEA IntelliJ is recommended (and free to Tapestry committers), but Eclipse will also work. NetBeans is reported to work as well.
- Install Firefox browser version 3.6, needed for the integration tests.
- Install a Git client
- Install Gradle 1.0-milestone-3 or newer (or a Gradle plugin to your IDE),
- Clone Tapestry from the Git repo:
git clone https://git-wip-us.apache.org/repos/asf/tapestry-5.git
IDE Preparation
- If using Eclipse:
- do
gradlew eclipse
- Gradle's eclipse plugin doesn't include the provided project dependencies; you need to add them manually (Java Build Path - Projects - Add tapestry-test). The plugin also generates a root eclipse project, so you'll need to delete the ".project" file in the root folder, and then you can import all Tapestry sub-projects at once.
- do
Building
You can build individual modules, or (from the root folder) build everything.
Tapestry 5 is built using Gradle. The following assumes you are using Gradle from the command line. "gradlew" is the gradle wrapper shell script (gradlew) or batch file (gradlew.bat) found in the root folder of the Tapestry source. Alternatively, with the right Gradle plugin you can do the builds from within your IDE.
gradlew build
Running Tests
The Tapestry integration tests will repeatedly start up a Firefox browser.
- Ensure that your environment will allow a connection to https://localhost:443
Skipping Tests
Running the Tapestry integration tests can take 10 minutes or more, so you won't want to run them every time you try a change.
gradlew build -x test
You can skip test on a specific module by adding a colon and the module name. For example: -x test:tapestry-ioc
Running the Integration Test Apps
The Tapestry source includes several web apps that are used by the automated Selenium integration tests. You can also run these apps manually to try out nearly every browser-visible aspect of Tapestry. (See a live example running on Google App Engine.)
- If using Eclipse:
- Use the run-jetty-run plugin in Eclipse, with the context directory selected from among the
test
context directories. For example, in the tapestry-core module use /src/test/app1 (or app2, etc).
- Use the run-jetty-run plugin in Eclipse, with the context directory selected from among the
Making Code Changes
Once you have cloned or pulled the latest changes to your local Git repository, you can start working on it. Whenever you make some changes to the codebase, it's good to have a related issue filed in JIRA and to use a similarly named branch in your local Git repository. For example, to create a branch for an issue with the key TAP5-123:
git branch TAP5-123 origin/trunk
With per-issue branches you can easily switch back and forth between different issues without worrying about unwanted side-effects from unfinished changes to other issues. Whenever you want to work on the TAP5-123 example issue, simply checkout that branch and start making your changes:
git checkout TAP5-123
It's a good idea to commit your changes to your local Git repo whenever you have finished one logical part of the issue. For example when refactoring, make a new commit for each refactoring step you take.
git commit
Pushing your commits upstream
First:
- Run the full suite of tests before pushing your commits to the upstream (remote) repository.
- Ensure your changes have full test coverage
Then:
_TODO_
Producing Patches
If you aren't an official committer (with write access to the Apache Tapestry Git repo), you'll need to submit changes via a patch.
See the recommendations at http://commons.apache.org/patches.html. (Obviously that isn't specifically for the Tapestry project, but most of the same principles apply.)
You can use the git format-patch command to produce a nice set of patches to attach to the relevant issue in JIRA:
git format-patch origin/trunk
The sooner you share your work the better. You can repeat the steps of this workflow as often as you like, producing more patches to be attached to the issue tracker. Once some of your patches are accepted and committed to svn, you can rebase your work against the latest trunk. Alternatively, if you're asked to make some changes, you can go back to the original Git commit and modify it until the project team accepts your changes.
Troubleshooting Hints
Problem: I can't run the build. it gives me an error in line 91:
20:22:11.438 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong: 20:22:11.439 [ERROR] [org.gradle.BuildExceptionReporter] A problem occurred evaluating root project 'tapestry-project-trunk'. 20:22:11.440 [ERROR] [org.gradle.BuildExceptionReporter] Cause: Cannot get property 'plus' on null object
Solution: Use the gradle wrapper (./gradlew build), not plain "gradle".