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: parent of parent artifact?
Date Thu, 08 Mar 2012 18:22:30 GMT
Hey Lars,

Great you ask these questions actually and I will try to answer to my best knowledge.

* First of all your understanding of maven archetypes is completely correct.  A maven archetype
is a project that creates a folder structure on your file system where the archetype itself
contains some default resources like e.g. a partially prefilled pom.xml and so on. 

* There is no need to declare any dependency on a cocoon block actually. But since version
2.2 Cocoon uses the servlet service framework.  I would compare a cocoon-block to a sub-webapp
potentially providing some Java components and pipelines which can be invoked from another
cocoon-block.

To give a concrete example.  At my customer I created 1 cocoon-block called 'shared' which
provides services to fetch files from a XMLDB, Alfresco, file system.  As customer requirements
grew, I created other blocks delivering needed functionality but they all need and use above
described services. So in that case I only needed to declare a dependency on this 'shared'
block.

That enables me to call this service from another sitemap as e.g.  <map:generate src="servlet:shared:/alfresco/{1}"/>
where {1} is some file identifier.

* Project / module / archetype and artifact are typical maven terms.
- Project should need no explanation
- module can be described as a part of the project
- archetype is explained above
- artifact is the thing that gets build when you run mvn package  (a war, jar, ...)

As a end user you should not be creating archetypes, merely using them as shown in the previous
mails. It will generate some skeleton maven projects for you.

Any further questions?
Robby

-----Original Message-----
From: Lars Huttar [mailto:lars_huttar@sil.org] 
Sent: Thursday, March 08, 2012 6:58 PM
To: users@cocoon.apache.org
Cc: Robby Pelssers
Subject: Re: parent of parent artifact?

Thanks for this...

I see that relative to the instructions I've been following, it 
eliminates creating a samples block, and optionally a parent block. It 
also makes clearer that the Cocoon block and webapp I create do not need 
to (should not) go in the same tree as the archetypes I installed, and 
are not archetypes themselves. (The instructions at 
http://cocoon.apache.org/3.0/download.html leave me with folder names 
like cocoon-archetype-webapp that make me think I've created a webapp 
archetype.)

One thing that would be helpful, when you write your blog post, would be 
a brief statement of why the demoblock (or any block) is needed as a 
dependency for the demoApp. I.e. what would happen if I tried to build 
and run the demoApp without the demoblock dependency?

Part of my question is stemming from the fact that I'm not clear on what 
a "block" actually means, despite seeing the word being used in the 
Cocoon world for years. In general I'm unclear on the difference between 
block/project/module/webapp/archetype/artifact, a couple of which seem 
to be used to refer to the same things sometimes. I have some inkling 
that an archetype is used as a template for creating other things, and 
is not meant to be used as an app itself. But then I'm not clear why I 
as a Cocoon user should be "creating" archetypes... shouldn't I be 
creating instances *from* archetypes? Maybe I'm just "installing" 
archetypes, to then use as templates to create instances of things? 
Anyway... hopefully my confusion is obvious. :-)

Thanks very much,
Lars



On 3/8/2012 3:36 AM, Robby Pelssers wrote:
> Notes Cocoon 3 quick start guide:
> ------------------------------------
>
> Check out latest sources from trunk.  In my case i checked them trunk out to
> c:/development/workspaces/cocoon3/trunk
>
> Next change directory into that folder and run mvn install:
>
> nxp10009@NXL01262 /c/development/workspaces/cocoon3/trunk
> $ mvn install
>
> Now would be a good time to get a coffee break as maven will download lots of dependencies
to your local maven repository.
>
> If the project builds fine you will see following output:
>
> [INFO] ------------------------------------------------------------------------
> [INFO] Reactor Summary:
> [INFO]
> [INFO] Apache Cocoon 3: Parent ........................... SUCCESS [5:19.105s]
> [INFO] Apache Cocoon 3: Utilities ........................ SUCCESS [1:04.795s]
> [INFO] Apache Cocoon 3: Pipeline ......................... SUCCESS [6.807s]
> [INFO] Apache Cocoon 3: SAX .............................. SUCCESS [2:07.826s]
> [INFO] Apache Cocoon 3: CLI .............................. SUCCESS [1:50.956s]
> [INFO] Apache Cocoon 3: Sitemap .......................... SUCCESS [51.180s]
> [INFO] Apache Cocoon 3: Controller ....................... SUCCESS [2.032s]
> [INFO] Apache Cocoon 3: Servlet .......................... SUCCESS [27.873s]
> [INFO] Apache Cocoon 3: Optional ......................... SUCCESS [2:24.414s]
> [INFO] Apache cocoon 3: Databases integration components . SUCCESS [15.561s]
> [INFO] Apache Cocoon 3: Monitoring ....................... SUCCESS [5.112s]
> [INFO] Apache Cocoon 3: REST support ..................... SUCCESS [36.879s]
> [INFO] Apache Cocoon 3: Profiling ........................ SUCCESS [18.912s]
> [INFO] Apache cocoon 3: Optional REST components ......... SUCCESS [48.551s]
> [INFO] Apache Cocoon 3: String Templates ................. SUCCESS [18.687s]
> [INFO] Apache Cocoon 3: Shiro integration ................ SUCCESS [15.846s]
> [INFO] Apache Cocoon 3: StAX ............................. SUCCESS [20.924s]
> [INFO] Apache Cocoon 3: Wicket Integration ............... SUCCESS [34.500s]
> [INFO] Apache Cocoon 3: All dependencies ................. SUCCESS [0.955s]
> [INFO] Apache Cocoon 3: Databases sample integration ..... SUCCESS [19.855s]
> [INFO] Apache Cocoon 3: Sample ........................... SUCCESS [28.252s]
> [INFO] Apache Cocoon 3: Shiro sample integration ......... SUCCESS [3.460s]
> [INFO] Apache Cocoon 3: Root ............................. SUCCESS [0.118s]
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 19:12.546s
> [INFO] Finished at: Thu Mar 08 09:50:26 CET 2012
> [INFO] Final Memory: 49M/127M
> [INFO] ------------------------------------------------------------------------
>
>
> The archetypes are not built and installed yet so let's manually install those first.
>
> nxp10009@NXL01262 /c/development/workspaces/cocoon3/trunk/cocoon-archetype-block
> $ mvn install
>
> nxp10009@NXL01262 /c/development/workspaces/cocoon3/trunk/cocoon-archetype-webapp
> $ mvn install
>
> Now let's start using the maven archetypes we juist built to quickly create a cocoon
block and cocoon webapp project.
> **********************************************************************************************
> nxp10009@NXL01262 /c/development/workspaces/cocoon3
> $ mvn archetype:generate \
>> -DgroupId=pelssers.cocoon \
>> -DartifactId=demoblock \
>> -Dversion=1.0-SNAPSHOT \
>> -DpackageName=com.pelssers \
>> -DarchetypeGroupId=org.apache.cocoon.archetype-block \
>> -DarchetypeArtifactId=cocoon-archetype-block \
>> -DarchetypeVersion=3.0.0-beta-1-SNAPSHOT \
>> -DinteractiveMode=false
>
> [INFO] Scanning for projects...
> [INFO]
> [INFO] ------------------------------------------------------------------------
> [INFO] Building Maven Stub Project (No POM) 1
> [INFO] ------------------------------------------------------------------------
> [INFO]
> [INFO]>>>  maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom>>>
> [INFO]
> [INFO]<<<  maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom<<<
> [INFO]
> [INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom ---
> [INFO] Generating project in Batch mode
> [INFO] Archetype repository missing. Using the one from [org.apache.cocoon.archetype-block:cocoon-archetype-block:3.0.0-alpha-3]
found in catalog remote
> [INFO] ----------------------------------------------------------------------------
> [INFO] Using following parameters for creating project from Old (1.x) Archetype: cocoon-archetype-block:3.0.0-beta-1-SNAPSHOT
> [INFO] ----------------------------------------------------------------------------
> [INFO] Parameter: groupId, Value: pelssers.cocoon
> [INFO] Parameter: packageName, Value: pelssers.cocoon
> [INFO] Parameter: package, Value: pelssers.cocoon
> [INFO] Parameter: artifactId, Value: demoblock
> [INFO] Parameter: basedir, Value: c:\development\workspaces\cocoon3
> [INFO] Parameter: version, Value: 1.0-SNAPSHOT
> [INFO] project created from Old (1.x) Archetype in dir: c:\development\workspaces\cocoon3\demoblock
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 4.044s
> [INFO] Finished at: Thu Mar 08 10:29:03 CET 2012
> [INFO] Final Memory: 7M/19M
> [INFO] ------------------------------------------------------------------------
>
>
>
> You should see that a demoblock has been created in your filesystem:
>
> nxp10009@NXL01262 /c/development/workspaces/cocoon3
> $ ls -la
> total 10
> drwxr-xr-x    4 nxp10009 Administ        0 Mar  8 10:29 .
> drwxr-xr-x   13 nxp10009 Administ     4096 Mar  8 09:19 ..
> drwxr-xr-x    4 nxp10009 Administ     4096 Mar  8 10:29 demoblock
> drwxr-xr-x   34 nxp10009 Administ    12288 Mar  8 09:30 trunk
> **********************************************************************************************
>
> Next we will also generate a webapp project using the maven archetype
>
> nxp10009@NXL01262 /c/development/workspaces/cocoon3
> $ mvn archetype:generate \
>>   -DgroupId=pelssers.cocoon \
>>   -DartifactId=demoApp \
>>   -Dversion=1.0-SNAPSHOT \
>>   -DpackageName=com.pelssers \
>>   -DarchetypeGroupId=org.apache.cocoon.archetype-webapp \
>>   -DarchetypeArtifactId=cocoon-archetype-webapp \
>>   -DarchetypeVersion=3.0.0-beta-1-SNAPSHOT \
>>   -DinteractiveMode=false
> [INFO] Scanning for projects...
> [INFO]
> [INFO] ------------------------------------------------------------------------
> [INFO] Building Maven Stub Project (No POM) 1
> [INFO] ------------------------------------------------------------------------
> [INFO]
> [INFO]>>>  maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom>>>
> [INFO]
> [INFO]<<<  maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom<<<
> [INFO]
> [INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom ---
> [INFO] Generating project in Batch mode
> [INFO] Archetype repository missing. Using the one from [org.apache.cocoon.archetype-webapp:cocoon-archetype-webapp:3.0.0-alpha-3]
found in catalog remote
> [INFO] ----------------------------------------------------------------------------
> [INFO] Using following parameters for creating project from Old (1.x) Archetype: cocoon-archetype-webapp:3.0.0-beta-1-SNAPSHOT
> [INFO] ----------------------------------------------------------------------------
> [INFO] Parameter: groupId, Value: pelssers.cocoon
> [INFO] Parameter: packageName, Value: pelssers.cocoon
> [INFO] Parameter: package, Value: pelssers.cocoon
> [INFO] Parameter: artifactId, Value: demoApp
> [INFO] Parameter: basedir, Value: c:\development\workspaces\cocoon3
> [INFO] Parameter: version, Value: 1.0-SNAPSHOT
> [INFO] project created from Old (1.x) Archetype in dir: c:\development\workspaces\cocoon3\demoApp
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 3.188s
> [INFO] Finished at: Thu Mar 08 10:31:54 CET 2012
> [INFO] Final Memory: 7M/19M
> [INFO] ------------------------------------------------------------------------
> **********************************************************************************************
>
> Check again if the demoApp has been created:
> nxp10009@NXL01262 /c/development/workspaces/cocoon3
> $ ls -la
> total 10
> drwxr-xr-x    5 nxp10009 Administ        0 Mar  8 10:31 .
> drwxr-xr-x   13 nxp10009 Administ     4096 Mar  8 09:19 ..
> drwxr-xr-x    3 nxp10009 Administ        0 Mar  8 10:31 demoApp
> drwxr-xr-x    4 nxp10009 Administ     4096 Mar  8 10:29 demoblock
> drwxr-xr-x   34 nxp10009 Administ    12288 Mar  8 09:30 trunk
>
>
> In fact it would have been better if I also created a parent pom project using the cocoon-archetype-parent
archetype. But at least you're now able to e.g. modify the pom from
> your demoApp and include e.g. that demoblock as a dependency.
>
> I will try to write a nice blog in the next few weeks and explain much more detailed
how to get up and running in 1 hour.
>
> Robby
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message