Yes, I've been playing around with getting the development/production part
working, and I think I've got it.

I am still having problems getting the yuicompressor:compress goal to be
called at the right time. The problem is that the war:war goal has a bunch
of actions backed into it, and I don't know a way to wire into it and call
the yuicompressor:compress goal just after it copies the webResources
directory. If I can solve that, I think I am golden. But I don't know if
that can be done.

Ken


On Sun, Dec 4, 2011 at 4:02 AM, Stephen Connolly <
stephen.alan.conno...@gmail.com> wrote:

> this is a perfect use case for profiles.
>
> in the release profile you use yui-compress to copy them into the war
>
> in a development profile you add warResources to construct the war from the
> direct sources....
>
> that (assuming the tomcat maven plugin is written right... jetty can do
> this for sure) will give development with live editing, and just -Prelease
> to get the compressed version
>
> - Stephen
>
> ---
> Sent from my Android phone, so random spelling mistakes, random nonsense
> words and other nonsense are a direct result of using swype to type on the
> screen
> On 4 Dec 2011 01:52, "Ken Egervari" <ken.egerv...@gmail.com> wrote:
>
> > I think I should just give up on this problem because I don't think Maven
> > has the ability to solve it, and if it does, I have no idea where to look
> > for a solution and its clear nobody else writing java web applications
> > knows how to solve this problem :/
> >
> > I guess I am stuck with manually including each main file on each page
> > where it is used, or coding everything in an all.js manually :/
> >
> > Even if I can get Maven to properly call the YUI:compress goal at the
> right
> > time, I still have maintain two lists of css and javascript files for my
> > application - one for the aggregations, and one for my freemarker
> template
> > that switches between using all the individual source files for
> > development, or using the all.css/all.js for production.
> >
> > I genuinely don't see a nice solution to do what the Rails people have
> > conveniently got in place. I am totally flustered that the Maven/Spring
> > combo has no good for answer to this problem :(
> >
> > Ken
> >
> >
> > On Sat, Dec 3, 2011 at 4:19 PM, Ken Egervari <ken.egerv...@gmail.com>
> > wrote:
> >
> > > I think the problem is that there is no phase I can merge into just
> after
> > > it prepares the war directory - at least not from where I can see in
> the
> > > life-cycle documentation. What is the phase name? Is it not any of the
> > > package or pre-package phases - it is still too early or too late.
> > >
> > > Ken
> > >
> > >
> > >
> > > On Fri, Dec 2, 2011 at 5:16 AM, Jeff MAURY <jeffma...@jeffmaury.com
> > >wrote:
> > >
> > >> 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
> > >>
> > >
> > >
> >
>

Reply via email to