cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robby Pelssers <Robby.Pelss...@nxp.com>
Subject RE: [C3] Working with archetypes [Was Re: parent of parent artifact?]
Date Wed, 21 Mar 2012 09:03:49 GMT
Hi Lars,

Can you explain what is the difference between mysite and mywebapp?

Just checking because I'm not sure if mysite is a cocoon block in this case.  I can tell you
sth about our current setup.
First of all our projects are situated in the same folder so any project referencing the parent
would be done like below:

    <parent>
        <groupId>com.nxp.spider2</groupId>
        <artifactId>productinformationparent</artifactId>
        <version>1.0-SNAPSHOT</version>
        <relativePath>../productinformation/pom.xml</relativePath>
    </parent>

Below a simplified scenario of our folders:


-          productinformation (parent)

-          productinformationwebapp  (created using the webapp archetype)

-          phared (cocoon block)

-          producttransformer  (cocoon block with dependency on shared block)


Snippet productinformation parent.pom:

    <modelVersion>4.0.0</modelVersion>
    <packaging>pom</packaging>

    <groupId>com.nxp.spider2</groupId>
    <artifactId>productinformationparent</artifactId>
    <version>1.0-SNAPSHOT</version>

    <name>Productinformation parent pom</name>

    <modules>
        <module>../productinformationwebapp</module>
        <module>../producttransformer</module>
        <module>../shared</module>
    </modules>

    <dependencyManagement>
        <dependencies>
            <!--  Apache Cocoon dependencies -->
            <dependency>
                <groupId>org.apache.cocoon</groupId>
                <artifactId>cocoon-sitemap-impl</artifactId>
                <version>1.0.1</version>
            </dependency>
         ....
  </dependencyManagement>

In the productinformationwebapp pom.xml  I list all dependencies to the cocoon-blocks  (e.g.
shared and producttransformer)
In the shared pom.xml I declare dependencies to all needed cocoon jars as well as other jars
In the producttransfomer.xml I declare again all needed cocoon dependencies as well as other
jars AND a dependency on this shared block.

To be able to use the servlet service dependency on the shared block from the producttransformer
I need to add it as a servlet connection in the spring application context.

  <bean name="com.nxp.spider2.producttransformer.service" class="org.apache.cocoon.sitemap.SitemapServlet">
    <servlet:context mount-path="/producttransformer" context-path="blockcontext:/producttransformer/">
      <servlet:connections>
        <entry key="shared" value-ref="com.nxp.spider2.shared.service"/>
      </servlet:connections>
    </servlet:context>
  </bean>


Whenever I work on a single cocoon block I  change into that directory and run 'mvn jetty:run'.
   The cocoon maven plugin will take care that the resources are copied over to
<webAppSourceDirectory>${project.build.directory}/rcl/webapp</webAppSourceDirectory>
 and by default it will  start jetty on port 8888.

Hope this helps  a bit.

Robby






From: Lars Huttar [mailto:lars_huttar@sil.org]
Sent: Tuesday, March 20, 2012 10:56 PM
To: users@cocoon.apache.org
Cc: Francesco Chicchiriccò
Subject: Re: [C3] Working with archetypes [Was Re: parent of parent artifact?]

On 3/20/2012 4:35 PM, Lars Huttar wrote:
On 3/8/2012 3:49 AM, Francesco Chicchiriccò wrote:

C) If you want to develop a complete C3 web application

You need to generate a multimodule maven project [2] with the following structure:

myparent/
    mysite/
    mywebapp/

Basically, you will need this when either having multiple blocks on a single webapp or when
you want to deploy on an external web container (say Tomcat).

In the context of these instructions, which now produce for me a working webapp shell,
where do I start developing my web application?
I expected that I could start putting sitemap.xmap, welcome.html, and other files in
   mywebapp/src/main/resources/COB-INF

I do this; and when I run
    cd thewebapp
    mvn jetty:run
My new sitemap etc. get copied to
   mywebapp/target/classes/COB-INF
as expected.

But when I try to address any URLs in my new sitemap, e.g. "localhost:8890/test.html", Cocoon
tells me (in mywebapp\target\work\cocoon.log) that there is no matching pipeline. But it *does*
match pipelines in the mysite sitemap (mysite\src\main\resource\COB-INF).

So then my question is, if I'm running jetty in the mywebapp folder, why is it serving URLs
from the mysite artifact's sitemap? Maybe that's by design, that the mysite sitemap is sort
of like a Cocoon 2.1 top-level sitemap, which would "mount" the sitemaps of the various webapps?

If this is true... that Cocoon will process URLs starting from mysite's sitemap even thought
I run jetty in the mywebapp folder... then why should be in the mywebapp folder to run jetty?
What difference would it make if I was in the myparent or mysite folder?

Trying to wrap my head around this...

Thanks,
Lars

Mime
View raw message