You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Leszek Gawron <lg...@mobilebox.pl> on 2006/08/01 19:58:16 UTC
My first steps with cocoon 2.2 mavenized application
So I've done:
mvn archetype:create -DarchetypeGroupId=org.apache.cocoon
-DarchetypeArtifactId=cocoon-22-archetype-block
-DarchetypeVersion=1.0.0-SNAPSHOT -DgroupId=com.mycompany
-DartifactId=myBlock
cd myBlock
mvn package
mvn cocoon:deploy
mvn jetty6:run
and I have a working webapp! That's awesome.
Still this way I am not able to create a war file. Do I need
cocoon-22-archetype-webapp for that? Does that mean that even simplest
application needs 2 maven modules?
I like that I can now integrate cocoon spring beans with my own
application contexts. How do I setup cocoon beans in test cases?
--
Leszek Gawron lgawron@mobilebox.pl
IT Manager MobileBox sp. z o.o.
+48 (61) 855 06 67 http://www.mobilebox.pl
mobile: +48 (501) 720 812 fax: +48 (61) 853 29 65
Re: My first steps with cocoon 2.2 mavenized application
Posted by Giacomo Pati <gi...@apache.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wed, 2 Aug 2006, Reinhard Poetz wrote:
> Date: Wed, 02 Aug 2006 07:12:17 +0200
> From: Reinhard Poetz <re...@apache.org>
> Reply-To: dev@cocoon.apache.org
> To: dev@cocoon.apache.org
> Subject: Re: My first steps with cocoon 2.2 mavenized application
>
> Leszek Gawron wrote:
>> Leszek Gawron wrote:
>> > Reinhard Poetz wrote:
>> > > > Does that mean that even simplest application needs 2 maven modules?
>> > >
>> > > not necessarily but it is recommended (IMO). If you put all your code
>> > > into the /src/main/java and /src/main/webapp directories it should
>> > > work too.
>>
>> If so wouldn't it be a good idea to provide an archetype that would create
>> both a webapp and a block and additionally a main pom file?
We used the webapp archetype and stuffed it with our java code as within
normal Maven 2 src/main/java
When building you need the install phase to make that code into the
webapp structure:
mvn clean install cocoon:deploy-war
and ready is your WAR File
HTH
Giacomo
- --
Giacomo Pati
Otego AG, Switzerland - http://www.otego.com
Orixo, the XML business alliance - http://www.orixo.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
iD8DBQFE2ZjFLNdJvZjjVZARAje+AKCNKLFQ3I1hyjmzT5OTNMfEYisxmACg9Hov
+ev4ML5n9OZE8WE+bLbiOUU=
=RSA0
-----END PGP SIGNATURE-----
Re: My first steps with cocoon 2.2 mavenized application
Posted by Reinhard Poetz <re...@apache.org>.
Leszek Gawron wrote:
> Leszek Gawron wrote:
>> Reinhard Poetz wrote:
>>>> Does that mean that even simplest application needs 2 maven modules?
>>>
>>> not necessarily but it is recommended (IMO). If you put all your code
>>> into the /src/main/java and /src/main/webapp directories it should
>>> work too.
>
> If so wouldn't it be a good idea to provide an archetype that would
> create both a webapp and a block and additionally a main pom file?
>
> My maven knowledge is poor.. maybe there was a way to chain both
> existing archetypes.
>
Not sure whether this can be easily done.
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
Re: My first steps with cocoon 2.2 mavenized application
Posted by Leszek Gawron <lg...@mobilebox.pl>.
Leszek Gawron wrote:
> Reinhard Poetz wrote:
>>> Does that mean that even simplest application needs 2 maven modules?
>>
>> not necessarily but it is recommended (IMO). If you put all your code
>> into the /src/main/java and /src/main/webapp directories it should
>> work too.
If so wouldn't it be a good idea to provide an archetype that would
create both a webapp and a block and additionally a main pom file?
My maven knowledge is poor.. maybe there was a way to chain both
existing archetypes.
--
Leszek Gawron lgawron@mobilebox.pl
IT Manager MobileBox sp. z o.o.
+48 (61) 855 06 67 http://www.mobilebox.pl
mobile: +48 (501) 720 812 fax: +48 (61) 853 29 65
Re: My first steps with cocoon 2.2 mavenized application
Posted by Leszek Gawron <lg...@mobilebox.pl>.
Carsten Ziegeler wrote:
>>> Example: Can I have my spring beans using cocoon xml parser? If so how
>>> do I instantiate some testing environment?
> Using Avalon components within your spring beans is easy. Just put your
> bean definition xml
> in the WEB-INF/cocoon/spring directory. You can refer to the avalon
> based components by using the role as the bean name, so
> org.bla.bla.SAXParser is the bean name of the cocoon xml parser.
>
> Now, for testing things are more complicated as setting up avalon based
> components through spring still requires the avalon environment. You can
> inherit your test case from CocoonTestCase which sets up the avalon
> enviromnent for you.
That is what I was afraid of. Unfortunatelly I would like the test cases
to extend from AbstractTransactionalDependencyInjectionTests (or
something in this matter, spring framework goes to the edge with those
long class names).
Is this feasible to come up with some kind of helper class that could be
used in any test case?
--
Leszek Gawron lgawron@mobilebox.pl
IT Manager MobileBox sp. z o.o.
+48 (61) 855 06 67 http://www.mobilebox.pl
mobile: +48 (501) 720 812 fax: +48 (61) 853 29 65
Re: My first steps with cocoon 2.2 mavenized application
Posted by Carsten Ziegeler <cz...@apache.org>.
>> Example: Can I have my spring beans using cocoon xml parser? If so how
>> do I instantiate some testing environment?
Using Avalon components within your spring beans is easy. Just put your
bean definition xml
in the WEB-INF/cocoon/spring directory. You can refer to the avalon
based components by using the role as the bean name, so
org.bla.bla.SAXParser is the bean name of the cocoon xml parser.
Now, for testing things are more complicated as setting up avalon based
components through spring still requires the avalon environment. You can
inherit your test case from CocoonTestCase which sets up the avalon
enviromnent for you.
HTH
Carsten
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/
Re: My first steps with cocoon 2.2 mavenized application
Posted by Leszek Gawron <lg...@mobilebox.pl>.
Reinhard Poetz wrote:
> Leszek Gawron wrote:
>> Reinhard Poetz wrote:
>>>> Does that mean that even simplest application needs 2 maven modules?
>>>
>>> not necessarily but it is recommended (IMO). If you put all your code
>>> into the /src/main/java and /src/main/webapp directories it should
>>> work too.
>>
>> Apart from the fact that some paths are hardcoded. Like in sitemap:
>>
>> <map:match pattern="blocks/myBlock/**">
>> <map:mount uri-prefix="blocks/myBlock"
>> src="file:/C:/temp/xxx/myBlock/src/main/resources/COB-INF/"/>
>> </map:match>
>
> when you call "cocoon:deploy" on a block (jar artifact), a minimal
> webapp is created which uses hard-coded absolute paths. I don't see a
> problem with this as it's only useful at development time.
>
>> So I can happily do some development but not release.
>
> yes, that was my intention.
>
>> Is there any way now to change the block mount point (without editing
>> sitemaps manually of course)? Is there a way to make one block the
>> default one and mount it under "/"?
>
> The current behaviour is that when you call "/", you are redirected to
> the default one. Is that not enough?
For development purposes of a single block - probably enough.
--
Leszek Gawron lgawron@mobilebox.pl
IT Manager MobileBox sp. z o.o.
+48 (61) 855 06 67 http://www.mobilebox.pl
mobile: +48 (501) 720 812 fax: +48 (61) 853 29 65
Re: My first steps with cocoon 2.2 mavenized application
Posted by Reinhard Poetz <re...@apache.org>.
Leszek Gawron wrote:
> Reinhard Poetz wrote:
>>> Does that mean that even simplest application needs 2 maven modules?
>>
>> not necessarily but it is recommended (IMO). If you put all your code
>> into the /src/main/java and /src/main/webapp directories it should
>> work too.
>
> Apart from the fact that some paths are hardcoded. Like in sitemap:
>
> <map:match pattern="blocks/myBlock/**">
> <map:mount uri-prefix="blocks/myBlock"
> src="file:/C:/temp/xxx/myBlock/src/main/resources/COB-INF/"/>
> </map:match>
when you call "cocoon:deploy" on a block (jar artifact), a minimal webapp is
created which uses hard-coded absolute paths. I don't see a problem with this as
it's only useful at development time.
> So I can happily do some development but not release.
yes, that was my intention.
> Is there any way now to change the block mount point (without editing
> sitemaps manually of course)? Is there a way to make one block the
> default one and mount it under "/"?
The current behaviour is that when you call "/", you are redirected to the
default one. Is that not enough?
>>> I like that I can now integrate cocoon spring beans with my own
>>> application contexts. How do I setup cocoon beans in test cases?
>>
>> What do you mean with Cocoon beans?
>
> Example: Can I have my spring beans using cocoon xml parser? If so how
> do I instantiate some testing environment?
Maybe Carsten can help here.
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
___________________________________________________________
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de
Re: My first steps with cocoon 2.2 mavenized application
Posted by Leszek Gawron <lg...@mobilebox.pl>.
Reinhard Poetz wrote:
>> Does that mean that even simplest application needs 2 maven modules?
>
> not necessarily but it is recommended (IMO). If you put all your code
> into the /src/main/java and /src/main/webapp directories it should work
> too.
Apart from the fact that some paths are hardcoded. Like in sitemap:
<map:match pattern="blocks/myBlock/**">
<map:mount uri-prefix="blocks/myBlock"
src="file:/C:/temp/xxx/myBlock/src/main/resources/COB-INF/"/>
</map:match>
So I can happily do some development but not release.
Is there any way now to change the block mount point (without editing
sitemaps manually of course)? Is there a way to make one block the
default one and mount it under "/"?
>> I like that I can now integrate cocoon spring beans with my own
>> application contexts. How do I setup cocoon beans in test cases?
>
> What do you mean with Cocoon beans?
Example: Can I have my spring beans using cocoon xml parser? If so how
do I instantiate some testing environment?
--
Leszek Gawron lgawron@mobilebox.pl
IT Manager MobileBox sp. z o.o.
+48 (61) 855 06 67 http://www.mobilebox.pl
mobile: +48 (501) 720 812 fax: +48 (61) 853 29 65
Re: My first steps with cocoon 2.2 mavenized application
Posted by Reinhard Poetz <re...@apache.org>.
Leszek Gawron wrote:
> So I've done:
>
> mvn archetype:create -DarchetypeGroupId=org.apache.cocoon
> -DarchetypeArtifactId=cocoon-22-archetype-block
> -DarchetypeVersion=1.0.0-SNAPSHOT -DgroupId=com.mycompany
> -DartifactId=myBlock
>
> cd myBlock
>
> mvn package
>
> mvn cocoon:deploy
>
> mvn jetty6:run
>
> and I have a working webapp! That's awesome.
>
> Still this way I am not able to create a war file. Do I need
> cocoon-22-archetype-webapp for that?
yes, but it hasn't been aligned with the latest changes Carsten and Daniel made.
I will take care of it on Thursday if none beats me.
> Does that mean that even simplest
> application needs 2 maven modules?
not necessarily but it is recommended (IMO). If you put all your code into the
/src/main/java and /src/main/webapp directories it should work too.
>
> I like that I can now integrate cocoon spring beans with my own
> application contexts. How do I setup cocoon beans in test cases?
What do you mean with Cocoon beans?
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
___________________________________________________________
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de
Re: My first steps with cocoon 2.2 mavenized application
Posted by Reinhard Poetz <re...@apache.org>.
Ralph Goers wrote:
>
>
> Reinhard Poetz wrote:
>>
>>>
>>> cause
>>>
>>> No default type exists for 'map:pipeline' at
>>> file:/C:/cygwin/home/Ralph/ctemp/myBlock/target/myBlock/sitemap.xmap:26:19
>>>
>>>
>>> request-uri
>>>
>>> /
>>>
>>> null 2.2.0-SNAPSHOT <http://cocoon.apache.org/>
>>>
>>>
>>
>> Do you have a minimal Cocoon web application in
>> file:/C:/cygwin/home/Ralph/ctemp/myBlock/target/myBlock/WEB-INF
>> containing cocoon/xconf and cocoon/sitemap-additions directories? It
>> looks like that you don't have
>> cocoon/sitemap-additions/cocoon-core.xmap there, do you?
> Yes, the web app is built, but not at that path. The real path should be
> c:/home/Ralph/ctemp/myBlock/target/myblock/sitemap.xmap. The deployer
> is apparently not taking into account the idiosyncrasies of cygwin when
> constructing the path. FWIW I never use the "normal" DOS command prompt
> as I much prefer bash and shell scripts and unix commands to the poor
> excuse MS provides, so not having this work is a real problem.
> Ralph
>
> Ralph
>
I guess this problem has to be solved in
http://svn.apache.org/repos/asf/cocoon/trunk/tools/cocoon-block-deployer/cocoon-deployer-plugin/src/main/java/org/apache/cocoon/maven/deployer/monolithic/DevelopmentBlock.java
by replacing the absolute URI by a relative path.
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
___________________________________________________________
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de
Re: My first steps with cocoon 2.2 mavenized application
Posted by Ralph Goers <Ra...@dslextreme.com>.
Reinhard Poetz wrote:
>
>>
>> cause
>>
>> No default type exists for 'map:pipeline' at
>> file:/C:/cygwin/home/Ralph/ctemp/myBlock/target/myBlock/sitemap.xmap:26:19
>>
>>
>> request-uri
>>
>> /
>>
>> null 2.2.0-SNAPSHOT <http://cocoon.apache.org/>
>>
>>
>
> Do you have a minimal Cocoon web application in
> file:/C:/cygwin/home/Ralph/ctemp/myBlock/target/myBlock/WEB-INF
> containing cocoon/xconf and cocoon/sitemap-additions directories? It
> looks like that you don't have
> cocoon/sitemap-additions/cocoon-core.xmap there, do you?
Yes, the web app is built, but not at that path. The real path should be
c:/home/Ralph/ctemp/myBlock/target/myblock/sitemap.xmap. The deployer
is apparently not taking into account the idiosyncrasies of cygwin when
constructing the path. FWIW I never use the "normal" DOS command prompt
as I much prefer bash and shell scripts and unix commands to the poor
excuse MS provides, so not having this work is a real problem.
Ralph
Ralph
Re: My first steps with cocoon 2.2 mavenized application
Posted by Reinhard Poetz <re...@apache.org>.
Ralph Goers wrote:
> Leszek Gawron wrote:
>> So I've done:
>>
>> mvn archetype:create -DarchetypeGroupId=org.apache.cocoon
>> -DarchetypeArtifactId=cocoon-22-archetype-block
>> -DarchetypeVersion=1.0.0-SNAPSHOT -DgroupId=com.mycompany
>> -DartifactId=myBlock
>>
>> cd myBlock
>>
>> mvn package
>>
>> mvn cocoon:deploy
>>
>> mvn jetty6:run
>>
>> and I have a working webapp! That's awesome.
>>
> That is pretty cool, except the webapp doesn't run for me. I run in
> cygwin and it fails with
>
>
> Internal Server Error
>
> Message: null
>
> Description: No details available.
>
> Sender: org.apache.cocoon.servlet.RequestProcessor
>
> Source: Cocoon Servlet
>
> Request URI
>
> cause
>
> No default type exists for 'map:pipeline' at file:/C:/cygwin/home/Ralph/ctemp/myBlock/target/myBlock/sitemap.xmap:26:19
>
> request-uri
>
> /
>
> null 2.2.0-SNAPSHOT <http://cocoon.apache.org/>
>
>
Do you have a minimal Cocoon web application in
file:/C:/cygwin/home/Ralph/ctemp/myBlock/target/myBlock/WEB-INF containing
cocoon/xconf and cocoon/sitemap-additions directories? It looks like that you
don't have cocoon/sitemap-additions/cocoon-core.xmap there, do you?
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de