This web page describes how to build Antimatter using Maven 2, one of the top build systems for the Java community.
A database is required in order to test an Antimatter build. The database is not, of course, required in order to compile the code. However, since the JUnit tests for Antimatter are automatically run whenever a build is done, it's best if you get a database set up before trying to do a build.
When building with Maven, there is generally a local Maven 2 file where user-defined settings can be defined. Strangely enough, this file is called "setings.xml". It's typically the location where you put user-specific settings, like database connection settings, that don't otherwise belong in Antimatter's "pom.xml" file. Here's where "settings.xml" can be found:
On Windows:
C:\Documents and Settings\<user name>\.m2\settings.xml
On a UNIX system:
~/.m2/settings.xml
The easiest database to test your build with is MySQL. So, install MySQL (or the database system of your choice), and create a database with a user account and a password. Consult the vendor's documentation on how to do set up the database.
OK. Now, you've successfully set up a local database...and it's currently running, right?
Great. So, now record your database connection settings in the "settings.xml" file, as shown below:
<settings>
<profiles>
<profile>
<id>testdb</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<testdb.jdbc.url>jdbc:mysql://localhost/yourdb</testdb.jdbc.url>
<testdb.jdbc.driver>com.mysql.jdbc.Driver</testdb.jdbc.driver>
<testdb.jdbc.username>your-username</testdb.jdbc.username>
<testdb.jdbc.password>your-password</testdb.jdbc.password>
</properties>
</profile>
</profiles>
<settings>
Now, your're ready to build Antimatter.
To build Antimatter, simply run the following command:
mvn package
This will compile Antimatter and run all of the tests. The first time you run this command in your build environment, it will take longer than subsequent runs. This is because of the time required to download any dependencies that have been defined for Antimatter.
The ibiblio.org site from which dependencies are downloaded may sometimes get busy enough to slow down the build process. This is unusual, but if it happens, you can either edit the "pom.xml" to use one of the mirrors instead, or you can wait and run that first build in the morning when the download repository is less busy.
To build the Antimatter development site, simply run the following command:
mvn site
This will create a sub-directory, "target/site", where the entire generated development site will be placed. To preview the development site, simply open up the top-level "index.html" file in your favorite browser.
Well, first, you're not going to be doing this unless you're one of the authorized core Antimatter developers. But if you are, well, the Antimatter development site is deployed as a sub-site of KeenerTech.com.
There are some issues that make deploying to KeenerTech problematic.
Ideally, the hosting company would support SSH. If they did, the SSH wagon (a type of component that provides transport services for Maven 2) could be used to easily deploy Antimatter directly to the web site (assuming suitable config settings were defined up in "pom.xml", which would be easy enough). Alas, AccuWebHosting, while otherwise a good hosting company, does not support SSH.
Well, there is an FTP wagon for Maven 2, and AccuWebHosting does support FTP access. Unfortunately, there is a long-standing, and unresolved, problem with the FTP wagon. It cannot handle a directory tree, only individual files. This is also a clear indication that most developers who use Maven to deploy development sites actually have SSH.
Since SSH is not supported by the hosting company, and FTP is not adequately supported by Maven 2, the simple command below will NOT work:
mvn site:deploy
Onwards to the next alternative. Deploy the development site to a staging directory, from which it can then be uploaded to KeenerTech.com using a separate tool. To do this, run the following command:
mvn site:stage
The "pom.xml" is currently configured to stage the site to the following directory:
c:\Keener\Stage\keenertech\antimatter
From there, the Antimatter directory can be uploaded to the site using a tool like DreamWeaver.