cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jos Snellings <Jos.Snelli...@pandora.be>
Subject Re: How/where to create a sitemap in a generated Cocoon 3 web app?
Date Fri, 02 Mar 2012 06:47:35 GMT
Hi Lars,

The instructions on the site are obscure because they presuppose a good 
deal of Maven knowledge.
Maven helps you to build the project: it puts all the files you need 
together and at first it feels metaphysical
(hey, will you let me control my own build?).

But here's what I do:

ThingToKnow1:  the elements you want to expose, and your sitemap are in 
the "block". Your "cocoon webapp"
is going to "mount" (my word choice) the blocks on a virtual path.
ThingToKnow2:  You control Mavens behaviour through editing pom.xml. Add 
your Cocoon block as dependency means that you are going to edit the 
pom.xml.

1.   create the webapp from the archetype. The webapp contains close to 
nothing.
       It will contain close to nothing. It should contain the 
"canonical structure" of a web project:
           pom.xml
           main
           main/resources
           main/webapp
           main/webapp/WEB-INF
           main/webapp/WEB-INF/applicationContext.xml
           main/webapp/WEB-INF/log4j.xml
           main/webapp/WEB-INF/web.xml

Edit pom.xml, you will see the section "dependencies". Add the 
dependency for the block you want to add (I said "mount",
but I guess that is old fashioned).

<dependencies>
<dependency>
<groupId>org.tiaterra</groupId>
<artifactId>myCocoonBlock</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>

2.  create your block from the archetype

      This will create a structure like:
src
src/test
src/test/resources
src/test/java
src/main
src/main/resources
src/main/resources/COB-INF
src/main/resources/COB-INF/javascript
src/main/resources/COB-INF/xslt
src/main/resources/COB-INF/images
src/main/resources/COB-INF/style
src/main/resources/COB-INF/style/images
src/main/resources/COB-INF/static-content
src/main/resources/META-INF
src/main/resources/META-INF/cocoon
src/main/resources/META-INF/cocoon/spring
src/main/java
src/main/java/org
src/main/java/org/tanteterra

Your site map is at:

src/main/resources/COB-INF/sitemap.xmap

And true, the documentation on the site does not make it easy enough to step
up the threshold and upgrade.
[@group: shouldn't we do something about that. Cocoon is losing its user 
base,
it will end up getting adopted only by a few old people out there. It is 
gaining momentum on the planet Zork but that's not
going to help us on Earth, is it?]

I hope this helps you on the way. It would make me very happy to know 
that I am not one of the sole developers
on this planet who chose cocoon 3 as a development platform, for the few 
times in your life that you are in the
position to make this choice for your customer! I chose for cocoon 3 
because I liked the new architecture.
[@group: this can be the start for a tutorial for newbies, someone 
interested? I feel that the maven integration and
the spring part deserve better explanation, they are way too arcane for 
starters. A tutorial could explain how to get things
done without first studying two other frameworks.]

Kind regards,
Jos Snellings


On 03/01/2012 11:59 PM, Lars Huttar wrote:
> Hello,
>
> We've been Cocoon 2.1.* users for years. We're now trying to shift to 
> the Cocoon 3 way of doing things.
> I barely understand Maven, but I'm willing to learn.
>
> I've installed Cocoon 3, and can run a sample.
>
> But now I'm having trouble figuring out how to build my own "hello 
> world" web application.
>
> What I did so far:
>
> |   svn checkout 
> http:||//svn.apache.org/repos/asf/cocoon/cocoon3/trunk c3|
>      cd c3
> |   mvn clean install
>    cd cocoon-databases-sample
>    mvn jetty:run
> |
>
> I can then access the running databases sample at
> http://localhost:8888/
> in the browser.
>
> I've generated the four Maven 2 archetypes as instructed at 
> http://cocoon.apache.org/3.0/download.html
> (sample, block, webapp, parent).
> I don't understand, though, what each one is for.
>
> For archetype-block, the instruction says "Create an empty Cocoon 3 
> block in order to create your own Cocoon 3 web application."
> But once I've done that, what do I do in the generated block in order 
> to create a web application?
>
> For archetype-webapp, it says "Create an empty Java web application 
> project. After that add your Cocoon block as dependency." I guess 
> Cocoon block refers to the previous thing I generated. How do I add it 
> as a dependency? I guess I should edit cocoon-archetype-webapp/pom.xml 
> and add this before </project>:
> <dependencies>
> <dependency>
> <groupId>org.apache.cocoon.archetype-block</groupId>
> <artifactId>cocoon-archetype-block</artifactId>
> </dependency>
> </dependencies>
>
> For archetype-parent, the instruction says "Create a parent module for 
> your Cocoon project." Is a project the same as a web application? Does 
> this mean I should edit the contents of <parent> in 
> archetype-webapp/pom.xml to point correctly to archetype-parent? (The 
> <parent> element is present already, but its groupId, artifactId, and 
> relativePath are a bit off from what would match the parent archetype 
> generated by the instructions.)
>
>
> **The main thing I want to know, though,** is where do I start 
> building a sitemap?
> In the working databases sample that I mentioned above, the only place 
> I find a sitemap is under target/samples/COB-INF.
> But the generated archetype-webapp/ folder doesn't have a target 
> subfolder structure. Is that something I generate using a maven command?
>
> Thanks!
> I look forward to using C3, and I feel like if I can get past this 
> point, I'll be able to start cooking.
>
> Lars
>


Mime
View raw message