Re: Poor man's web.xml merging

2006-11-07 Thread Arnaud Bailly
Ouuup !

[INFO] [cargo:uberwar]
[INFO] 
[ERROR] BUILD ERROR
[INFO] 
[INFO] Exception merging web.xml

[INFO] 
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Exception merging 
web.xml
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:475)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:454)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:306)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:273)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:140)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Exception merging 
web.xml
at 
org.codehaus.cargo.maven2.UberWarMojo.doWebXmlMerge(UberWarMojo.java:214)
at org.codehaus.cargo.maven2.UberWarMojo.execute(UberWarMojo.java:169)
at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:412)
at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:534)
... 16 more
Caused by: java.lang.NullPointerException
at 
org.codehaus.cargo.maven2.UberWarMojo.doWebXmlMerge(UberWarMojo.java:208)
... 19 more
[INFO] 
[INFO] Total time: 7 seconds
[INFO] Finished at: Tue Nov 07 10:55:44 CET 2006
[INFO] Final Memory: 5M/11M
[INFO] 

Here is my merge.xml:

uberwar

  wars
wartoto:tutu-web/war
wartoto:tutu-testui/war
  /wars

/uberwar


-- 
OQube  software engineering \ génie logiciel 
Arnaud Bailly, Dr.
\web http://www.oqube.com


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Poor man's web.xml merging

2006-11-07 Thread Vincent Massol
Hi Arnaud,

I haven't worked on that code so I don't know what's wrong. I do know that
people are able to use it though so it's possible you could get it to work
and the error may be a configuration error.

I think the best would be for you to post anything related to Cargo on the
Cargo user list as the author of this code is reading the emails there. He
may not see it here though.

Thanks
-Vincent

 -Original Message-
 From: Arnaud Bailly [mailto:[EMAIL PROTECTED]
 Sent: mardi 7 novembre 2006 11:05
 To: Maven Users List
 Subject: Re: Poor man's web.xml merging
 
 Ouuup !
 
 [INFO] [cargo:uberwar]
 [INFO] 
 
 [ERROR] BUILD ERROR
 [INFO] 
 
 [INFO] Exception merging web.xml
 
 [INFO] 
 
 [DEBUG] Trace
 org.apache.maven.lifecycle.LifecycleExecutionException: Exception
 merging web.xml
 at
 org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defaul
 tLifecycleExecutor.java:559)
 at
 org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLife
 cycle(DefaultLifecycleExecutor.java:475)
 at
 org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Default
 LifecycleExecutor.java:454)
 at
 org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandl
 eFailures(DefaultLifecycleExecutor.java:306)
 at
 org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments
 (DefaultLifecycleExecutor.java:273)
 at
 org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLife
 cycleExecutor.java:140)
 at
 org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
 at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
 at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
 va:39)
 at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
 rImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at
 org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
 at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
 at
 org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
 at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
 Caused by: org.apache.maven.plugin.MojoExecutionException: Exception
 merging web.xml
 at
 org.codehaus.cargo.maven2.UberWarMojo.doWebXmlMerge(UberWarMojo.java:21
 4)
 at
 org.codehaus.cargo.maven2.UberWarMojo.execute(UberWarMojo.java:169)
 at
 org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginM
 anager.java:412)
 at
 org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defaul
 tLifecycleExecutor.java:534)
 ... 16 more
 Caused by: java.lang.NullPointerException
 at
 org.codehaus.cargo.maven2.UberWarMojo.doWebXmlMerge(UberWarMojo.java:20
 8)
 ... 19 more
 [INFO] 
 
 [INFO] Total time: 7 seconds
 [INFO] Finished at: Tue Nov 07 10:55:44 CET 2006
 [INFO] Final Memory: 5M/11M
 [INFO] 
 
 
 Here is my merge.xml:
 
 uberwar
 
   wars
 wartoto:tutu-web/war
 wartoto:tutu-testui/war
   /wars
 
 /uberwar
 
 
 --
 OQube  software engineering \ génie logiciel 
 Arnaud Bailly, Dr.
 \web http://www.oqube.com
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]






___
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
Profitez des connaissances, des opinions et des expériences des internautes sur 
Yahoo! Questions/Réponses
http://fr.answers.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Poor man's web.xml merging

2006-11-07 Thread Nigel Magnay

I think your merge.xml is required to have a context params section

e.g :

webXml
   contextParams
 strategy name=ChooseByName
   default
 strategy name=Preserve/
   /default
   choice name=contextConfigLocation
 strategy name=NodeMerge
   context-param
 param-name$left:param-name/param-name
 param-value$left:param-value $right:param-value/param-value
   /context-param
 /strategy
   /choice
 /strategy
   /contextParams

 /webXml


On 07/11/06, Arnaud Bailly [EMAIL PROTECTED] wrote:


Ouuup !

[INFO] [cargo:uberwar]
[INFO]

[ERROR] BUILD ERROR
[INFO]

[INFO] Exception merging web.xml

[INFO]

[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Exception merging
web.xml
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
DefaultLifecycleExecutor.java:559)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle
(DefaultLifecycleExecutor.java:475)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal
(DefaultLifecycleExecutor.java:454)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures
(DefaultLifecycleExecutor.java:306)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(
DefaultLifecycleExecutor.java:273)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(
DefaultLifecycleExecutor.java:140)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:256)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java
:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(
Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Exception
merging web.xml
at org.codehaus.cargo.maven2.UberWarMojo.doWebXmlMerge(
UberWarMojo.java:214)
at org.codehaus.cargo.maven2.UberWarMojo.execute(UberWarMojo.java
:169)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(
DefaultPluginManager.java:412)
at
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(
DefaultLifecycleExecutor.java:534)
... 16 more
Caused by: java.lang.NullPointerException
at org.codehaus.cargo.maven2.UberWarMojo.doWebXmlMerge(
UberWarMojo.java:208)
... 19 more
[INFO]

[INFO] Total time: 7 seconds
[INFO] Finished at: Tue Nov 07 10:55:44 CET 2006
[INFO] Final Memory: 5M/11M
[INFO]


Here is my merge.xml:

uberwar

  wars
wartoto:tutu-web/war
wartoto:tutu-testui/war
  /wars

/uberwar


--
OQube  software engineering \ génie logiciel 
Arnaud Bailly, Dr.
\web http://www.oqube.com


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Poor man's web.xml merging

2006-11-06 Thread Vincent Massol
Hi Arnaud,

There's also some code to merge Wars in Cargo's code. See
http://cargo.codehaus.org/Merging+WAR+files

I haven't used it myself so I don't know how well it works but it may be
worth a try.

Thanks
-Vincent


 -Original Message-
 From: Arnaud Bailly [mailto:[EMAIL PROTECTED]
 Sent: lundi 6 novembre 2006 23:14
 To: users@maven.apache.org
 Subject: Poor man's web.xml merging
 
 While trying to use war plugin for overlaying two webapps, I was
 bitten by the somewhat obvious problem of how to merge web
 descriptors. There does not seem to exist a standard (read mainstream)
 way of doing this. All I found searching the ML on nabble was a
 reference to some custom development modifying the plugin's standard
 behavior and I did not however search the Jira issues.
 
 While certainly not against modifying plugins to suite my needs, I
 tried to find a solution less intrusive and I came up with one
 simple solution that may (or may not) be worth sharing: Use inclusion
 in XML descriptor through internal subset mechanism. This solution is
 not really elegant and may become rapidly unwieldy if the number of
 webapps to merge is too important or rapidly changing, but it has the
 advantage of relying on standard XML mechanisms and not changing maven
 or its plugins.
 
 1. Make your web.xml filterable:
 You need to add some filtered repository to the war plugin and put
 your WEB-INF/web.xml in it. Add the following to the build section:
 
plugin
 artifactIdmaven-war-plugin/artifactId
 configuration
  webResources
   webResource
directory${basedir}/src/main/webapp-filtered/directory
filteringtrue/filtering
includes
   include**/*.xml/include
/includes
   /webResource
  /webResources
 /configuration
/plugin
 
 2. Add an entity definition into web.xml:
 Each entity definition is a SYSTEM reference whose content is some
 variable that will later be filtered:
 
 ?xml version=1.0 encoding=ISO-8859-1?
 !DOCTYPE web-app
 PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
 http://java.sun.com/dtd/web-app_2_3.dtd; [
 !ENTITY external.servlet  SYSTEM ${testui.include.servlet} 
 !ENTITY external.servlet-mapping  SYSTEM ${testui.include.mapping} 
 ]
 
 3. Add entities references as needed in the web.xml file.
 You need to breakdown the imported descriptor so that DTD validator is
 kept happy. You could also set your web application container's XML
 parser to some lenient mode so that DTD validation is not enforced
 (not tried this).
 
 !-- conditional inclusion of testui descriptor --
 external.servlet;
 
   servlet
   servlet-nameInit/servlet-name
   servlet-classtoto.Init/servlet-class
   load-on-startup1/load-on-startup
   /servlet
 
 ...
 
 !-- conditional inclusion of testui descriptor --
 external.servlet-mapping;
 
   servlet-mapping
   servlet-namewebapp/servlet-name
   url-pattern/my-app/url-pattern
   /servlet-mapping
 
 ...
 
 4. Add profiles that defines the needed properties to some consistent
value.
 In this case, we set a test and a production profile: test profile
 import some content while production profile import dummy (empty)
 fragments.
 
 
  profiles
 
   profile
idweb-test/id
properties
 testui.include.servletservlet.xml/testui.include.servlet
 testui.include.mappingservlet-
 mapping.xml/testui.include.mapping
/properties
 
dependencies
 dependency
  groupIdtoto/groupId
  artifactIdtest-webapp/artifactId
  version${version}/version
  typewar/type
 /dependency
/dependencies
   /profile
 
   profile
 
idweb-prod/id
properties
 testui.include.servletdummy-servlet.xml/testui.include.servlet
 testui.include.mappingdummy-mapping.xml/testui.include.mapping
/properties
   /profile
  /profiles
 
 5. In test-webapp project, create servlet.xml and servlet-mapping.xml
 fragments from the full descriptor in WEB-INF
 
 6. Then run mvn install with either profile set. With mvn -P web-test,
 you end up with a web application containing the imported test-webapp
 project's content and with a web.xml like:
 
 ?xml version=1.0 encoding=ISO-8859-1?
 !DOCTYPE web-app
 PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
 http://java.sun.com/dtd/web-app_2_3.dtd; [
 !ENTITY external.servlet  SYSTEM servlet.xml 
 !ENTITY external.servlet-mapping  SYSTEM servlet-mapping.xml 
 ]
 
 Note that war overlay mechanism took care of copying servlet.xml and
 servlet-mapping.xml from test-webapp.
 
 At load time, the XML parser for the container (tested with Jetty6)
 should resolve entities content and include the named files into the
 web.xml.
 
 7. enjoy :-)
 
 As already said, I tried all this on one container only and with two
 simple web applications. But as this is standard XML mechanism, and
 not particularly bleeding edge XML, I do have reasons to 

Re: Poor man's web.xml merging

2006-11-06 Thread Arnaud Bailly
Vincent Massol [EMAIL PROTECTED] writes:

 Hi Arnaud,

 There's also some code to merge Wars in Cargo's code. See
 http://cargo.codehaus.org/Merging+WAR+files

 I haven't used it myself so I don't know how well it works but it may be
 worth a try.


Thanks Vincent for the pointer. It is obviously much richer thahn my
solution :-), I will give it try ASAP.

-- 
OQube  software engineering \ génie logiciel 
Arnaud Bailly, Dr.
\web http://www.oqube.com


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]