You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alan Garfield <al...@fromorbit.com> on 2009/05/03 13:19:47 UTC

Putting HTML files in src/main/webapp

Hi all,

Just a quick question, I'd like to move all the .html files so my
directory layout will be :-

.
|-- pom.xml
\-- src
    |-- main
    |    |-- java
    |    |    \-- com
    |    |        \-- foo
    |    |            |-- WicketApplication.java
    |    |            \-- bar.java
    |    |-- resources
    |    \-- webapp
    |        |-- com
    |        |    \-- foo
    |        |        \-- bar.html
    |        \-- WEB-INF
    \-- test

I've setup my pom.xml like :-

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
            </resource>
            <resource>
                <directory>src/main/webapp</directory>
                <includes>
                    <include>**/*.html</include>
                </includes>
            </resource>
 [..]
        </resources>
    </build>

Which works, but I end up with duplicate html files and directories in
the root of the war. I've not found an easy way to change this default.
Anyone else have an idea?

Many thanks!

Alan.


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


Re: Putting HTML files in src/main/webapp

Posted by Alan Garfield <al...@fromorbit.com>.
On Tue, 2009-05-05 at 08:26 -0400, Richard Allen wrote:
> To make Luther's point more explicit:
> 
> Wicket allows you to bundle everything a Wicket component needs (Java code,
> HTML, CSS, images, etc.) into a single JAR and drop that JAR into the
> WEB-INF/lib directory of any WAR, thereby making the JAR essentially
> self-contained and reusable. The benefit this provides is the ability to
> truly componentize (or modularize) your web application. You can break a
> large project up into modules that become separate JAR Maven projects. Or
> you can break out reusable components into separate JAR Maven projects that
> get reused in different web applications.
> 
> You can't take advantage of that if you put the resources in the root of
> WAR.

Thanks Richard, that really needs to be in the wiki somewhere. It's
clear and makes the advantages obvious. Previous to my question it all
appeared to be just for the sake of ease, but now it's rather apparent
why it is the way it is. I've read many sites/tutorials/mailing list
archives and the "Wicket in Action" book but it never was really
explained that well. Some even have their own differing confusing
opinions and variations. But then again maybe I just wasn't looking
right.

Regards,
Alan.





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


Re: Putting HTML files in src/main/webapp

Posted by Richard Allen <ri...@gmail.com>.
To make Luther's point more explicit:

Wicket allows you to bundle everything a Wicket component needs (Java code,
HTML, CSS, images, etc.) into a single JAR and drop that JAR into the
WEB-INF/lib directory of any WAR, thereby making the JAR essentially
self-contained and reusable. The benefit this provides is the ability to
truly componentize (or modularize) your web application. You can break a
large project up into modules that become separate JAR Maven projects. Or
you can break out reusable components into separate JAR Maven projects that
get reused in different web applications.

You can't take advantage of that if you put the resources in the root of
WAR.

-Richard

On Tue, May 5, 2009 at 4:03 AM, Luther Baker <lu...@gmail.com> wrote:

> > Separates the code from the templates so the designers don't have to
> > checkout the whole project, also keeps all the content in one directory.
> > Even though they are dynamic template files for wicket there is a
> > certain amount of static stuff that would be nice to be in one place.
> >
>
> If you simply want to separate the file types, you can separate the *.html
> files into the src/main/resources directory. That separates the Java code
> from the HTML templates, it gives you a completely separate directory tree
> for the *.html files and it keeps all the html content in one directory. In
> addition, it is standard Maven practice to separate non-Java files into the
> src/main/resources directory. All standard Maven builds should work just
> fine.
>
> Additionally, under Netbeans it seems to me to be rather daft that there
> > is a folder is called "Web Pages" in the project view but all it
> > contains is image/binary files and the WEB-INF directory.
>
>
> Just a little background, by definition, Wicket defines a non-traditional
> web application structure. It intentionally avoids the use of the web page
> directory structure you are likely used to. It turns out that to do what
> you
> are asking, you are actually fighting both Wicket and Maven. Traditional
> HTML and JSP pages can be visited directly - but not so with Wicket html
> files. They are read in from the classpath and much more tightly bound to
> an
> actual Java class.
>
> Trying to fit your Wicket app into a traditional structure can be done ...
> but it is not standard Wicket practice and you're going to end up with
> custom configuration that you'll have to manage.
>
>
> > But the actual
> > HTML files end up in the "Source Packages" or worse "Other Sources"
> > folder. I understand the reasons for putting them in the source packages
> > directories but it's not an ideal solution to my mind and my team.
>
>
> That is fair. If you're simply after your aforementioned points, try
> dropping the *.html files into src/main/resources.
>
> -Luther
>

Re: Putting HTML files in src/main/webapp

Posted by Alan Garfield <al...@fromorbit.com>.
On Tue, 2009-05-05 at 03:03 -0500, Luther Baker wrote:
> > Separates the code from the templates so the designers don't have to
> > checkout the whole project, also keeps all the content in one directory.
> > Even though they are dynamic template files for wicket there is a
> > certain amount of static stuff that would be nice to be in one place.
> >
> 
> If you simply want to separate the file types, you can separate the *.html
> files into the src/main/resources directory. That separates the Java code
> from the HTML templates, it gives you a completely separate directory tree
> for the *.html files and it keeps all the html content in one directory. In
> addition, it is standard Maven practice to separate non-Java files into the
> src/main/resources directory. All standard Maven builds should work just
> fine.

Thanks that's pretty much where I've ended up.

> Additionally, under Netbeans it seems to me to be rather daft that there
> > is a folder is called "Web Pages" in the project view but all it
> > contains is image/binary files and the WEB-INF directory.
> 
> 
> Just a little background, by definition, Wicket defines a non-traditional
> web application structure. It intentionally avoids the use of the web page
> directory structure you are likely used to. It turns out that to do what you
> are asking, you are actually fighting both Wicket and Maven. Traditional
> HTML and JSP pages can be visited directly - but not so with Wicket html
> files. They are read in from the classpath and much more tightly bound to an
> actual Java class.
> 
> Trying to fit your Wicket app into a traditional structure can be done ...
> but it is not standard Wicket practice and you're going to end up with
> custom configuration that you'll have to manage.

Thanks for the explanation, that makes sense to me now. You should
probably add something like this to the wiki as I couldn't find a really
good reason and the examples where a little light.


> > But the actual
> > HTML files end up in the "Source Packages" or worse "Other Sources"
> > folder. I understand the reasons for putting them in the source packages
> > directories but it's not an ideal solution to my mind and my team.
> 
> 
> That is fair. If you're simply after your aforementioned points, try
> dropping the *.html files into src/main/resources.

Thanks, it does seem a little silly to me as far as Netbeans is
concerned (also the million directories that might be needed to handle
com.foo.bar.web.pages.panels etc), but less than it did after your
explanation. It'll be fine with the files being in "Other
Sources/resources".

Many thanks Luther!

Alan.


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


Re: Putting HTML files in src/main/webapp

Posted by Luther Baker <lu...@gmail.com>.
> Separates the code from the templates so the designers don't have to
> checkout the whole project, also keeps all the content in one directory.
> Even though they are dynamic template files for wicket there is a
> certain amount of static stuff that would be nice to be in one place.
>

If you simply want to separate the file types, you can separate the *.html
files into the src/main/resources directory. That separates the Java code
from the HTML templates, it gives you a completely separate directory tree
for the *.html files and it keeps all the html content in one directory. In
addition, it is standard Maven practice to separate non-Java files into the
src/main/resources directory. All standard Maven builds should work just
fine.

Additionally, under Netbeans it seems to me to be rather daft that there
> is a folder is called "Web Pages" in the project view but all it
> contains is image/binary files and the WEB-INF directory.


Just a little background, by definition, Wicket defines a non-traditional
web application structure. It intentionally avoids the use of the web page
directory structure you are likely used to. It turns out that to do what you
are asking, you are actually fighting both Wicket and Maven. Traditional
HTML and JSP pages can be visited directly - but not so with Wicket html
files. They are read in from the classpath and much more tightly bound to an
actual Java class.

Trying to fit your Wicket app into a traditional structure can be done ...
but it is not standard Wicket practice and you're going to end up with
custom configuration that you'll have to manage.


> But the actual
> HTML files end up in the "Source Packages" or worse "Other Sources"
> folder. I understand the reasons for putting them in the source packages
> directories but it's not an ideal solution to my mind and my team.


That is fair. If you're simply after your aforementioned points, try
dropping the *.html files into src/main/resources.

-Luther

Re: Putting HTML files in src/main/webapp

Posted by Alan Garfield <al...@fromorbit.com>.
On Tue, 2009-05-05 at 07:23 -0400, James Carman wrote:
> Ok, if you really want to do this and you don't want to use
> src/main/resources, have you checked out:
> 
> http://wicketstuff.org/wicket13/customresourceloading/
> 
> That has some code examples on how to load html templates from the
> document root.  That might help you.

Thanks for that. I only just found that by chance in Google a few
minutes ago. Although upon my response from Luther I think I'll stick
with the files being in the resources directory. It's the least amount
of change (eg. none) and it suits my purposes fully.

Many thanks again,
Alan.



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


Re: Putting HTML files in src/main/webapp

Posted by James Carman <jc...@carmanconsulting.com>.
Ok, if you really want to do this and you don't want to use
src/main/resources, have you checked out:

http://wicketstuff.org/wicket13/customresourceloading/

That has some code examples on how to load html templates from the
document root.  That might help you.


On Mon, May 4, 2009 at 9:31 PM, Alan Garfield <al...@fromorbit.com> wrote:
> On Mon, 2009-05-04 at 21:07 -0400, James Carman wrote:
>> What's the justification of having them in src/main/webapp again?
>
> Separates the code from the templates so the designers don't have to
> checkout the whole project, also keeps all the content in one directory.
> Even though they are dynamic template files for wicket there is a
> certain amount of static stuff that would be nice to be in one place.
>
> Additionally, under Netbeans it seems to me to be rather daft that there
> is a folder is called "Web Pages" in the project view but all it
> contains is image/binary files and the WEB-INF directory. But the actual
> HTML files end up in the "Source Packages" or worse "Other Sources"
> folder. I understand the reasons for putting them in the source packages
> directories but it's not an ideal solution to my mind and my team.
>
> Looking at the debug from org.apache.wicket.util.resource it looks like
> Wicket already looks for all and sundry anyway. How do I make it look in
> the webroot?
>
> Thanks,
> Alan.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Putting HTML files in src/main/webapp

Posted by Alan Garfield <al...@fromorbit.com>.
On Mon, 2009-05-04 at 21:07 -0400, James Carman wrote:
> What's the justification of having them in src/main/webapp again?

Separates the code from the templates so the designers don't have to
checkout the whole project, also keeps all the content in one directory.
Even though they are dynamic template files for wicket there is a
certain amount of static stuff that would be nice to be in one place.

Additionally, under Netbeans it seems to me to be rather daft that there
is a folder is called "Web Pages" in the project view but all it
contains is image/binary files and the WEB-INF directory. But the actual
HTML files end up in the "Source Packages" or worse "Other Sources"
folder. I understand the reasons for putting them in the source packages
directories but it's not an ideal solution to my mind and my team.

Looking at the debug from org.apache.wicket.util.resource it looks like
Wicket already looks for all and sundry anyway. How do I make it look in
the webroot?

Thanks,
Alan.



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


Re: Putting HTML files in src/main/webapp

Posted by James Carman <jc...@carmanconsulting.com>.
What's the justification of having them in src/main/webapp again?

On Mon, May 4, 2009 at 8:28 PM, Alan Garfield <al...@fromorbit.com> wrote:
> On Mon, 2009-05-04 at 08:55 -0400, Richard Allen wrote:
>> If you are using <packaging>war</packaging>, then the maven-war-plugin will
>> automatically pick up the resources in src/main/webapp, which means you do
>> not have to configure that directory as a resource. Additionally, the
>> maven-resources-plugin automatically picks up resources in
>> src/main/resources, so you don't have to explicitly configure that either.
>> Try removing that configuration and see what happens.
>
>
> Thanks for that, but that's not really my issue. How do I make Wicket
> find the .html files in the root of the war? The hack I have with maven
> at the moment properly constructs the war by copying all the .html files
> into the classes folder for Wicket to find, but maven also helpfully
> copies them into the war's root as well creating duplicates in the war.
> This is what I'm trying to stop as it makes the war bigger than it needs
> to be, and is confusing to other developers if they look at the war.
>
> I've also tried to make Wicket load it's .html files from the root of
> the war, but I cannot seem to get the incantation right. I've tried to
> follow :-
>
> http://cwiki.apache.org/WICKET/control-where-html-files-are-loaded-from.html#ControlwhereHTMLfilesareloadedfrom-InWicket1.3
>
> but I'm having little success.
>
> Thanks,
> Alan.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

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


Re: Putting HTML files in src/main/webapp

Posted by Avraham Rosenzweig <av...@gmail.com>.
Try this:
http://www.mkyong.com/wicket/how-do-change-the-html-file-location-wicket/

On Tue, Sep 28, 2010 at 12:45 PM, elesi <js...@gmail.com> wrote:

>
> Could i change html resource folder, even if my project don't have a maven
> folder structure?
> I mean no resources folder, etc.?
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-Offline-Applications-tp1883788p2716953.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
[]'s
Avraham Rosenzweig
avrahamr@gmail.com

Re: Putting HTML files in src/main/webapp

Posted by elesi <js...@gmail.com>.
Could i change html resource folder, even if my project don't have a maven
folder structure?
I mean no resources folder, etc.?
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-Offline-Applications-tp1883788p2716953.html
Sent from the Users forum mailing list archive at Nabble.com.

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


Re: Putting HTML files in src/main/webapp

Posted by Steve Swinsburg <s....@lancaster.ac.uk>.
Ok glad you got it sorted.

For reference, you can adjust the excludes/includes in the build  
section of the POM to exclude the HTML  files from being added. Then  
use the maven-war-plugin to take control of what goes where.

cheers,
Steve





On 5 May 2009, at 13:52, Alan Garfield wrote:

> On Tue, 2009-05-05 at 12:33 +0100, Steve Swinsburg wrote:
>> Alan,
>>
>> The fragment of XML from the pom that I posted IS in the Wicket
>> Quickstart generated via "mvn archetype:generate". It's also in the
>> pom when you use the helper code available here: http://wicket.apache.org/quickstart.html
>>
>> Hence why it's not a hack, it's standard Maven stuff. You don't need
>> the maven war plugin to generate the default war either.
>
> Indeed, but if you read my original post fully I wasn't asking about  
> the
> resources folder or the standard way, I was wanting them in the webapp
> folder which with the default quickstart wicket pom doesn't work.
>
> And I quote myself "Thanks for that, but that's not really my issue.  
> How
> do I make Wicket find the .html files in the __root of the war__? The
> hack I have with maven at the moment properly constructs the war by
> copying all the .html files into the classes folder for Wicket to  
> find,
> but maven also helpfully copies them into __the war's root__ as well
> creating duplicates in the war."
>
> As you can see my "hack" comment wasn't talking about a standard
> structure hence my use of the word. My changed directory structure was
> the "hack". You read "hack" and completely missed my question for
> something else.
>
>
>> However, since you are doing it in a non standard way then you'll  
>> need
>> the maven war plugin to assemble your war in the way you want.
>
> Indeed! Which was the reason for my original question. The war-plugin
> helpfully copies the contents of the webapp directory into the war,  
> BUT
> if you also declare the resources as per the XML fragment to point at
> the webapp dir, then maven will copy the html files twice. Once into  
> the
> classes directory structure as needed by Wicket and once into the
> webroot of the war as per the defaults of the war-plugin. That was my
> question, how do I stop maven (further the war-plugin) or how do you
> change the way Wicket loads the HTML so that I don't end up with two
> copies of the same files in the war.
>
> I may not have structure my question properly because I'm not fully
> versed with maven or wicket so you must excuse my inexperience.
>
>
>> You said this:
>>>> Thanks for that, but that's not really my issue. How do I make  
>>>> Wicket
>>>> find the .html files in the root of the war?
>>
>>
>> So I gave you a link to do that.  Since your HTML files will now be  
>> in
>> a non standard location (ie not next to the classes) you will need to
>> configure your app to look in the location you desire, and that
>> information is available in the wiki link I posted:
>>>> http://cwiki.apache.org/WICKET/control-where-html-files-are-loaded-from.html
>
> Again, I even posted that exact same link you quoted in the email you
> responded to!
>
>
>> All of this information is readily available; first search item for
>> the configuration, quickstart for pom.
>
> Well I must be not looking right, because it wasn't really apparent to
> me.
>
> I'm going to go with Luther's suggestion and use the default resources
> folder to make what I need to happen happen. That way there is no
> messing about with modifications to Wicket and no clumsy fiddling with
> maven to move files into and out of weird directory structures.
>
> Thanks anyway,
> Alan.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


Re: Putting HTML files in src/main/webapp

Posted by Alan Garfield <al...@fromorbit.com>.
On Tue, 2009-05-05 at 12:33 +0100, Steve Swinsburg wrote:
> Alan,
> 
> The fragment of XML from the pom that I posted IS in the Wicket  
> Quickstart generated via "mvn archetype:generate". It's also in the  
> pom when you use the helper code available here: http://wicket.apache.org/quickstart.html
> 
> Hence why it's not a hack, it's standard Maven stuff. You don't need  
> the maven war plugin to generate the default war either.

Indeed, but if you read my original post fully I wasn't asking about the
resources folder or the standard way, I was wanting them in the webapp
folder which with the default quickstart wicket pom doesn't work.

And I quote myself "Thanks for that, but that's not really my issue. How
do I make Wicket find the .html files in the __root of the war__? The
hack I have with maven at the moment properly constructs the war by
copying all the .html files into the classes folder for Wicket to find,
but maven also helpfully copies them into __the war's root__ as well
creating duplicates in the war."

As you can see my "hack" comment wasn't talking about a standard
structure hence my use of the word. My changed directory structure was
the "hack". You read "hack" and completely missed my question for
something else.


> However, since you are doing it in a non standard way then you'll need  
> the maven war plugin to assemble your war in the way you want.

Indeed! Which was the reason for my original question. The war-plugin
helpfully copies the contents of the webapp directory into the war, BUT
if you also declare the resources as per the XML fragment to point at
the webapp dir, then maven will copy the html files twice. Once into the
classes directory structure as needed by Wicket and once into the
webroot of the war as per the defaults of the war-plugin. That was my
question, how do I stop maven (further the war-plugin) or how do you
change the way Wicket loads the HTML so that I don't end up with two
copies of the same files in the war.

I may not have structure my question properly because I'm not fully
versed with maven or wicket so you must excuse my inexperience.


> You said this:
> >> Thanks for that, but that's not really my issue. How do I make Wicket
> >> find the .html files in the root of the war?
> 
> 
> So I gave you a link to do that.  Since your HTML files will now be in  
> a non standard location (ie not next to the classes) you will need to  
> configure your app to look in the location you desire, and that  
> information is available in the wiki link I posted:
> >> http://cwiki.apache.org/WICKET/control-where-html-files-are-loaded-from.html

Again, I even posted that exact same link you quoted in the email you
responded to!


> All of this information is readily available; first search item for  
> the configuration, quickstart for pom.

Well I must be not looking right, because it wasn't really apparent to
me.

I'm going to go with Luther's suggestion and use the default resources
folder to make what I need to happen happen. That way there is no
messing about with modifications to Wicket and no clumsy fiddling with
maven to move files into and out of weird directory structures.

Thanks anyway,
Alan.




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


Re: Putting HTML files in src/main/webapp

Posted by Steve Swinsburg <s....@lancaster.ac.uk>.
Alan,

The fragment of XML from the pom that I posted IS in the Wicket  
Quickstart generated via "mvn archetype:generate". It's also in the  
pom when you use the helper code available here: http://wicket.apache.org/quickstart.html

Hence why it's not a hack, it's standard Maven stuff. You don't need  
the maven war plugin to generate the default war either.

However, since you are doing it in a non standard way then you'll need  
the maven war plugin to assemble your war in the way you want.

You said this:
>> Thanks for that, but that's not really my issue. How do I make Wicket
>> find the .html files in the root of the war?


So I gave you a link to do that.  Since your HTML files will now be in  
a non standard location (ie not next to the classes) you will need to  
configure your app to look in the location you desire, and that  
information is available in the wiki link I posted:
>> http://cwiki.apache.org/WICKET/control-where-html-files-are-loaded-from.html


All of this information is readily available; first search item for  
the configuration, quickstart for pom.

Steve



On 5 May 2009, at 10:11, Alan Garfield wrote:

> On Tue, 2009-05-05 at 08:32 +0100, Steve Swinsburg wrote:
>>
>> On 05/05/2009, at 1:28 AM, Alan Garfield wrote:
>>
>>>
>>> The hack I have with maven
>>> at the moment properly constructs the war by copying all the .html
>>> files
>>> into the classes folder for Wicket to find...
>>
>> What 'hack' do you need for Maven to include the HTML in the classes
>> directory? Presumably, since most other Wicket developers have their
>> HTML alongside their classes, they need this hack as well right? It's
>> just standard maven building:
>
> I didn't want to start a religious argument. I don't want to ruffle
> anyone's feathers. I didn't mean "hack" as a bad thing, I meant that I
> added a resource directive to Maven (ala below) to include the HTML  
> from
> the webapp directory and it helpfully copied it twice as part of the  
> war
> plugin. Without this "change" to the default wicket-quickstart POM
> Wicket still wouldn't find them. That was all I meant, hack was  
> probably
> the wrong word and I apologies if I upset anyone. At the same time,  
> why
> attack me when all I asked was a simple question I couldn't find the
> answer to elsewhere.
>
>
>> Add this to your POM to add everything except the Java source, as is.
>> It's even in the Maven quickstart:
>>
>> <build>
>> 		<resources>
>> 			<resource>
>> 				<filtering>false</filtering>
>> 				<directory>${basedir}/src/java</directory>
>> 				<includes>
>> 					<include>**</include>
>> 				</includes>
>> 				<excludes>
>> 					<exclude>**/*.java</exclude>
>> 				</excludes>
>> 			</resource>
>> 		</resources>	
>> 	</build>
>>
>> Nonetheless, the first result from a search for wicket html location
>> (Safari even autofilled the last word for me) I found this:
>> http://cwiki.apache.org/WICKET/control-where-html-files-are-loaded-from.html
>
> Thanks Steve for the added condescending tone there, but above isn't
> shown in the wiki you just posted (I also looked at that before  
> posting,
> I even attempted to use the non-maven partitioning method but without
> much documentation on the PathStripperLocator and a working example I
> got lost).
>
> I posted here as a last resort to my question and wasn't looking to be
> verbally beaten up because I asked a question that might be outside  
> the
> norm.
>
> Thanks anyway,
> Alan.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


Re: Putting HTML files in src/main/webapp

Posted by Alan Garfield <al...@fromorbit.com>.
On Tue, 2009-05-05 at 08:32 +0100, Steve Swinsburg wrote:
> 
> On 05/05/2009, at 1:28 AM, Alan Garfield wrote:
> 
> >
> >  The hack I have with maven
> > at the moment properly constructs the war by copying all the .html  
> > files
> > into the classes folder for Wicket to find...
> 
> What 'hack' do you need for Maven to include the HTML in the classes  
> directory? Presumably, since most other Wicket developers have their  
> HTML alongside their classes, they need this hack as well right? It's  
> just standard maven building:

I didn't want to start a religious argument. I don't want to ruffle
anyone's feathers. I didn't mean "hack" as a bad thing, I meant that I
added a resource directive to Maven (ala below) to include the HTML from
the webapp directory and it helpfully copied it twice as part of the war
plugin. Without this "change" to the default wicket-quickstart POM
Wicket still wouldn't find them. That was all I meant, hack was probably
the wrong word and I apologies if I upset anyone. At the same time, why
attack me when all I asked was a simple question I couldn't find the
answer to elsewhere.


> Add this to your POM to add everything except the Java source, as is.  
> It's even in the Maven quickstart:
> 
> <build>
> 		<resources>
> 			<resource>
> 				<filtering>false</filtering>
> 				<directory>${basedir}/src/java</directory>
> 				<includes>
> 					<include>**</include>
> 				</includes>
> 				<excludes>
> 					<exclude>**/*.java</exclude>
> 				</excludes>
> 			</resource>
> 		</resources>	
> 	</build>
> 
> Nonetheless, the first result from a search for wicket html location  
> (Safari even autofilled the last word for me) I found this:
> http://cwiki.apache.org/WICKET/control-where-html-files-are-loaded-from.html

Thanks Steve for the added condescending tone there, but above isn't
shown in the wiki you just posted (I also looked at that before posting,
I even attempted to use the non-maven partitioning method but without
much documentation on the PathStripperLocator and a working example I
got lost).

I posted here as a last resort to my question and wasn't looking to be
verbally beaten up because I asked a question that might be outside the
norm.

Thanks anyway,
Alan.




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


Re: Putting HTML files in src/main/webapp

Posted by Steve Swinsburg <s....@lancaster.ac.uk>.

On 05/05/2009, at 1:28 AM, Alan Garfield wrote:

>
>  The hack I have with maven
> at the moment properly constructs the war by copying all the .html  
> files
> into the classes folder for Wicket to find...

What 'hack' do you need for Maven to include the HTML in the classes  
directory? Presumably, since most other Wicket developers have their  
HTML alongside their classes, they need this hack as well right? It's  
just standard maven building:

Add this to your POM to add everything except the Java source, as is.  
It's even in the Maven quickstart:

<build>
		<resources>
			<resource>
				<filtering>false</filtering>
				<directory>${basedir}/src/java</directory>
				<includes>
					<include>**</include>
				</includes>
				<excludes>
					<exclude>**/*.java</exclude>
				</excludes>
			</resource>
		</resources>	
	</build>

Nonetheless, the first result from a search for wicket html location  
(Safari even autofilled the last word for me) I found this:
http://cwiki.apache.org/WICKET/control-where-html-files-are-loaded-from.html

Steve

Re: Putting HTML files in src/main/webapp

Posted by Alan Garfield <al...@fromorbit.com>.
On Mon, 2009-05-04 at 08:55 -0400, Richard Allen wrote:
> If you are using <packaging>war</packaging>, then the maven-war-plugin will
> automatically pick up the resources in src/main/webapp, which means you do
> not have to configure that directory as a resource. Additionally, the
> maven-resources-plugin automatically picks up resources in
> src/main/resources, so you don't have to explicitly configure that either.
> Try removing that configuration and see what happens.


Thanks for that, but that's not really my issue. How do I make Wicket
find the .html files in the root of the war? The hack I have with maven
at the moment properly constructs the war by copying all the .html files
into the classes folder for Wicket to find, but maven also helpfully
copies them into the war's root as well creating duplicates in the war.
This is what I'm trying to stop as it makes the war bigger than it needs
to be, and is confusing to other developers if they look at the war.

I've also tried to make Wicket load it's .html files from the root of
the war, but I cannot seem to get the incantation right. I've tried to
follow :-

http://cwiki.apache.org/WICKET/control-where-html-files-are-loaded-from.html#ControlwhereHTMLfilesareloadedfrom-InWicket1.3

but I'm having little success.

Thanks,
Alan.



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


Re: Putting HTML files in src/main/webapp

Posted by Richard Allen <ri...@gmail.com>.
If you are using <packaging>war</packaging>, then the maven-war-plugin will
automatically pick up the resources in src/main/webapp, which means you do
not have to configure that directory as a resource. Additionally, the
maven-resources-plugin automatically picks up resources in
src/main/resources, so you don't have to explicitly configure that either.
Try removing that configuration and see what happens.

-Richard

On Sun, May 3, 2009 at 7:19 AM, Alan Garfield <al...@fromorbit.com> wrote:

> Hi all,
>
> Just a quick question, I'd like to move all the .html files so my
> directory layout will be :-
>
> .
> |-- pom.xml
> \-- src
>    |-- main
>    |    |-- java
>    |    |    \-- com
>    |    |        \-- foo
>    |    |            |-- WicketApplication.java
>    |    |            \-- bar.java
>    |    |-- resources
>    |    \-- webapp
>    |        |-- com
>    |        |    \-- foo
>    |        |        \-- bar.html
>    |        \-- WEB-INF
>    \-- test
>
> I've setup my pom.xml like :-
>
>    <build>
>        <resources>
>            <resource>
>                <directory>src/main/resources</directory>
>            </resource>
>            <resource>
>                <directory>src/main/webapp</directory>
>                <includes>
>                    <include>**/*.html</include>
>                </includes>
>            </resource>
>  [..]
>        </resources>
>    </build>
>
> Which works, but I end up with duplicate html files and directories in
> the root of the war. I've not found an easy way to change this default.
> Anyone else have an idea?
>
> Many thanks!
>
> Alan.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>