You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Oren Livne <ol...@aoce.utah.edu> on 2008/06/26 05:00:52 UTC

Including XML files in maven war file

Dear All,

I am building my first Struts 2 application. I'm using maven 2.0.9, jdk 
1.6.0_06 and jetty 6.1.10 to deploy inline in maven.
Here is my src/main/resources/struts.xml:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
    <package name="default" namespace="/" extends="struts-default">
    </package>
   
    <include file="net/ruready/web/front/front.xml" />
   
</struts>

It points to front.xml, which sits in 
src/main/java/net/ruready/web/front and looks like this:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
    <package name="front" extends="struts-default">

        <!-- Home page -->
        <action name="home">
            <result>/jsp/front/home.jsp</result>
        </action>
       
    </package>
</struts>

However, when I run "mvn jetty:run", Struts 2 doesn't find the action 
"front/home.action". I looked in the target directory as well as in the 
war file packaged with the command "mvn package", and I saw that 
front.xml was NOT included in WEB-INF/classes/net/ruready/web/front. How 
can I include it? I would like to use xml files in my source folders. I 
tried to tweak the maven war plugin but to no avail.

Could you kindly help me?
Thanks,
Oren

-- 
===========================================================================
I can stand brute force, but brute reason is quite unbearable.
							-- Oscar Wilde
---------------------------------------------------------------------------
Oren Livne, Ph.D.
RUReady Software Architect
Academic Outreach and Continuing Education, 1901 E South Campus Dr.
Room 2197-D, University of Utah, Salt Lake City, UT 84112-9399
Tel  : (801) 581-6831     Cell: (801) 631-3885     Fax: (801) 585-5414
Email: olivne@aoce.utah.edu              Web:  http://ruready.net/oren
===========================================================================


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Including XML files in maven war file

Posted by Lukasz Lenart <lu...@googlemail.com>.
Hi

>   <package name="front" extends="struts-default">

Add namespace attribute like this namespace="/front"

> However, when I run "mvn jetty:run", Struts 2 doesn't find the action
> "front/home.action". I looked in the target directory as well as in the war
> file packaged with the command "mvn package", and I saw that front.xml was
> NOT included in WEB-INF/classes/net/ruready/web/front. How can I include it?

Put fron.txml file with whole path under src/main/resources, maven
only looks for classes from src/main/java and all other *.proeprties,
*.xml should be unser src/main/resources


Regards
-- 
Lukasz
http://www.lenart.org.pl/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org