There's a lot that confuses me too about how to get this to work with
tomcat:run. For example, if I am in development mode, I actually want to
use the uncompressed javascript files for the same reason you said - it'll
be better to debug and reason about the code. But I'd also like to test the
production profile I made just to make sure everything continues to work
after the files are compressed. I don't want to just "trust it" ;) At least
not until I feel really comfortable with everything and I know it all will
just work.

Essentially, my goal is to have an easy programming model where I can
create and edit javascript files and test them when my application is run
via tomcat in development mode, but then I want the application to use the
all.js when the application is running in tomcat in production mode.

Ken


On Fri, Dec 2, 2011 at 11:38 PM, Ken Egervari <ken.egerv...@gmail.com>wrote:

> I tried to bind this to the prepare-package phase actually, but the
> copying of the webapp resources directory to the target directory still
> occurs after the yui:compress goal. Am I missing something? Setting the
> phase to process-resources actually runs the yui:compress goal before the
> compilation step.
>
> One idea I have to fix this is maybe put the javascript in
> src/main/scripts and then compress everything to src/main/webapp/scripts...
> that way the package goal treats the regular source path as the final
> product. The real drawback to this though is that I won't be able to test
> my development javascript code anymore - I'd have to run the yui:compressgoal 
> EVERY time I make a change to the css and javascript - that's just too
> much of hassle for me.
>
> I'd also like to get functionality to work with the tomcat:run goal as
> well. Am I trying to get this to work with too much?
>
> Thanks for the assistance!
>
>
> On Fri, Dec 2, 2011 at 12:22 PM, Olivier Lamy <ol...@apache.org> wrote:
>
>> and bind the yui compressor to prepare-package phase.
>> As it js files will be compressed only when you will package your war
>> for deployment on target servlet container.
>> So js files won't be change using tomcat:run (IMHO better to have real
>> js files for debugging purpose).
>>
>> 2011/12/2 Robert Scholte <rfscho...@codehaus.org>:
>> >
>> > You could keep the names of the files the same (so without the -min
>> postfix), so modifications are picked up immediately.
>> >
>> >
>> >
>> > -Robert
>> >
>> >
>> >> From: jeffma...@jeffmaury.com
>> >> Date: Fri, 2 Dec 2011 11:16:01 +0100
>> >> Subject: Fwd: YUI Compressor Maven plugin executed at wrong time and
>> tomcat plugin not using yui-compressor output
>> >> To: users@maven.apache.org
>> >>
>> >> By default, the compress goal of the YUI maven plugin is bound to the
>> >> process-resources phase.
>> >> So, you need to bind it to another phase after the war plugin has
>> produced
>> >> the war directory structure the Tomcat plugin will use.
>> >> I recommand you also customize the outputDirectory parameter of the YUI
>> >> maven plugin because the default value does not comply with the
>> standard
>> >> Maven War directory layout.
>> >>
>> >> Regards
>> >> Jeff MAURY
>> >>
>> >> ---------- Forwarded message ----------
>> >> From: fe.character.guide <fe.character.gu...@gmail.com>
>> >> Date: Fri, Dec 2, 2011 at 7:17 AM
>> >> Subject: YUI Compressor Maven plugin executed at wrong time and tomcat
>> >> plugin not using yui-compressor output
>> >> To: users@maven.apache.org
>> >>
>> >>
>> >> Hello everyone!
>> >>
>> >> I'm trying to get some basic maven build processes configured correctly
>> >> with my Java project, and beyond Stackoverflow, I'm not sure
>> >> where else to turn.
>> >>
>> >> I'd like to compress all of my javascript files and aggregate them
>> using
>> >> YUICompressor, and I saw that there was a maven plugin to allow me to
>> do
>> >> this. I got it working for the most part.
>> >>
>> >> I am also using the Mojo tomcat plugin as well. When i go to run the
>> >> tomcat:run goal, tomcat does not read from the target's output
>> >> directory (this is where the YUI compressor put my javascript files) -
>> but
>> >> rather, it reads from the actual source files in my "src/main/
>> >> webapp/scripts" directory. Of course, the aggregated javascript file
>> >> (all.js) is not there. This makes sense, but is a big problem for me.
>> >>
>> >> I have a few questions.
>> >>
>> >> 1. How can I get the tomcat plugin to read the target's output folder
>> that
>> >> the yui compressor plugin created?
>> >>
>> >> 2. Do I have to run the yui compressor maven goal every time I want to
>> >> update my javascript files during development while my tomcat instance
>> is
>> >> running?
>> >>
>> >> 3. How can tell Maven that I want to run the YUI compressor AFTER Maven
>> >> copies over the `src/main/webapp` directory? Currently, Maven runs the
>> YUI
>> >> compressor, but then overwrites all of the compressed css and
>> javascript
>> >> files with the original source files, defeating the purposes of
>> compressing
>> >> them ;)
>> >>
>> >> 4. Is there a better way to achieve my objective rather than using the
>> YUI
>> >> compressor? Essentially, my end goal is to be able to develop
>> JavaScript
>> >> code in separate files and test my source files in development mode
>> without
>> >> having to aggregate them... but I want to compress and aggregate the
>> files
>> >> and use the `all.js` script when the application is running in
>> production
>> >> mode.
>> >>
>> >> While the Rails people have certainly figured this out, this seems to
>> be a
>> >> non-trivial thing to do with Maven and Spring.
>> >> I would appreciate any and all assistance on how I can get this running
>> >> correctly. Thanks!
>> >>
>> >>
>> >>
>> >> --
>> >> "Legacy code" often differs from its suggested alternative by actually
>> >> working and scaling.
>> >> - Bjarne Stroustrup
>> >>
>> >> http://www.jeffmaury.com
>> >> http://riadiscuss.jeffmaury.com
>> >> http://www.twitter.com/jeffmaury
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>> > For additional commands, e-mail: users-h...@maven.apache.org
>> >
>>
>>
>>
>> --
>> Olivier Lamy
>> Talend: http://coders.talend.com
>> http://twitter.com/olamy | http://linkedin.com/in/olamy
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>> For additional commands, e-mail: users-h...@maven.apache.org
>>
>>
>

Reply via email to