This guide was prepared with help from a guide written on the GSLIS wiki by Wendell Piez. If you try it and something doesn't work, please e-mail me (quinnd -at- uchicago +dot+ edu). This document is licensed Creative Commons Attribution.
No knowledge of Ubuntu or Unix is assumed; the intended audience is someone who's managed to install Ubuntu and isn't too intimidated by the Terminal.
sudo apt-get install sun-java6-jdk(Hint: You can copy and paste, but in Terminal, pasting is Ctrl + Shift +C)
Derived from Maven in Five Minutes.
cd /usr/local sudo mkdir apache-mavenAt this point, the Terminal will ask you for your sudo password. It's the same as the password you use to log in to Ubuntu. Then:
cd /home/YOUR_USER_NAME/Desktop(be sure to replace YOUR_USER_NAME with your user name)
sudo mv apache-maven-2.0.9 /usr/local/apache-maven export M2_HOME=/usr/local/apache-maven/apache-maven-2.0.9 export PATH=$M2:$PATH
mvn --version
Derived from Your first Cocoon application.
mkdir cocoon
cd cocoon mvn archetype:generate -DarchetypeCatalog=http://cocoon.apache.org
mvn jetty:run
There are a couple add-ons for Cocoon that are essentials-- like generators for HTML. If you want to use XSLT 2.0, Saoxn 9 is also critical. Posibly less important are the FOP processor (to generate PDFs from XSL-FO), Batik (for SVG) and Forms (to genrate forms). If you don't need to use XSLT 2.0, you can skip the first part of this section.
<?xml version="1.0" encoding="UTF-8"?> <components> <component role="org.apache.excalibur.xml.xslt.XSLTProcessor/saxon" class="org.apache.cocoon.components.xslt.TraxProcessor"> <parameter name="use-store" value="true"/> <parameter name="transformer-factory" value="net.sf.saxon.TransformerFactoryImpl"/> </component> </components>
<?xml version="1.0" encoding="UTF-8"?> <map:components xmlns:map="http://apache.org/cocoon/sitemap/1.0"> <map:transformers> <map:transformer name="xslt2" src="org.apache.cocoon.transformation.TraxTransformer"> <xslt-processor-role>saxon</xslt-processor-role> </map:transformer> </map:transformers> </map:components>
cd cocoon
mvn install:install-file -DgroupId=net.sf.saxon -DartifactId=saxon -Dversion=9.1.0.5 -Dpackaging=jar -Dfile=../saxon9.jar<dependency> <groupId>net.sf.saxon</groupId> <artifactId>saxon</artifactId> <version>9.1.0.5</version> </dependency>
<dependency> <groupId>org.apache.cocoon</groupId> <artifactId>cocoon-html-impl</artifactId> <version>1.0.0</version> </dependency>
<dependency> <groupId>org.apache.cocoon</groupId> <artifactId>cocoon-fop-impl</artifactId> <version>1.0.0</version> </dependency>
<dependency> <groupId>org.apache.cocoon</groupId> <artifactId>cocoon-batik-impl</artifactId> <version>1.0.0</version> </dependency>
<dependency>
<groupId>org.apache.cocoon</groupId>
<artifactId>cocoon-forms-impl</artifactId>
<version>1.0.0-RC1</version>
</dependency>
cd cocoon
mvn compileAfter it's done...
mvn jetty:run
You can add your pipelines to the sitemap.xmap in cocoon/src/main/resources/COB-INF, or (more conveniently) you can tell that base sitemap to look elsewhere for your files.
I'm assuming here that you have a folder called myproject in your Home folder where you have all your files and your sitemap. Please change that, and your user name, accordingly.
Included here is also the code to generate more useful error messages than a blank pages.
In sitemap.xmap in cocoon/src/main/resources/COB-INF, at the bottom of the <pipelines< section, add:
<map:pipeline> <map:handle-errors> <map:generate type="exception"/> <map:serialize type="xml"/> </map:handle-errors> <map:match pattern="myproject/**"> <map:mount uri-prefix="myproject/" check-reload="yes" src="/home/YOUR_USER_NAME/myproject/sitemap.xmap" reload-method="synchron"/> </map:match> </map:pipeline>
In this case, your project will be found at http://localhost:8888/cocoonTest/myproject/[things that match your pipelines]. But it doesn't have to match the folder name with your files. You can change the URL by chanigng <map:match pattern="myproject/**"> to <map:match pattern="whatever_you_want/**">
Every time you restart Ubuntu, you have to restart Cocoon:
cd cocoon mvn jetty:runBe sure to keep that Terminal window open while you're working with Cocoon. You can always check if Cocoon is working by going to: http://localhost:8888/cocoonTest.