Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven yui compressor plugin cannot create aggregation given a longer path?

I'm trying to create two css aggregations - one for the public site and one for the application part of the site.

If I make the output file ${project.build.directory}/${project.build.finalName}/css/public-all.css, everything works.

[INFO] generate aggregation : C:\Users\me\IdeaProjects\myapp-development\target\myapp-1.0\css\public-all.css
[INFO] public-all.css (32029b)
[INFO] generate aggregation : C:\Users\me\IdeaProjects\myapp-development\target\myapp-1.0\css\application-all.css
[INFO] application-all.css (50446b)

But if I try and output the aggregated file to another subdirectory, such as ${project.build.directory}/${project.build.finalName}/css/public/all.css, it gives the following error:

[INFO] generate aggregation : C:\Users\me\IdeaProjects\myapp-development\target\myapp-1.0\css\public\all.css
[WARNING] all.css not created
[INFO] generate aggregation : C:\Users\me\IdeaProjects\myapp-development\target\myapp-1.0\css\application\all.css
[WARNING] all.css not created

Why are they not getting created? Why is this even a warning and not an out-right failure of the plugin?

Here is the pom.xml part where I am specifying the aggregations. Why on earth is this not working?

                    <aggregation>
                        <removeIncluded>false</removeIncluded>
                        <insertNewLine>true</insertNewLine>
                        <output>${project.build.directory}/${project.build.finalName}/css/public/all.css</output>
                        <includes>
                            <include>**/public/base.css</include>
                            <include>**/fancybox/jquery.fancybox-1.3.4.css</include>
                        </includes>
                    </aggregation>
                    <aggregation>
                        <removeIncluded>false</removeIncluded>
                        <insertNewLine>true</insertNewLine>
                        <output>${project.build.directory}/${project.build.finalName}/css/application/all.css</output>
                        <includes>
                            <include>**/application/reset.css</include>
                            <include>**/application/text.css</include>
                            <include>**/application/960.css</include>
                            <include>**/smoothness/jquery-ui-1.8.11.custom.css</include>
                            <include>**/application/base.css</include>
                            <include>**/jcrop/jquery.jcrop.css</include>
                            <include>**/farbtastic/farbtastic.css</include>
                        </includes>
                    </aggregation>

I checked and these directories exist too. If I try and point to a directory that doesn't exist, the yuicompressor:compress will fail. I just don't understand why the build process actually succeeds given valid directories, but it doesn't create the files in those directories. It makes no sense!

I thought that maybe it was a filesystem security problem, but that isn't it either.

I am genuinely baffled as to why this doesn't work.

Please help.

like image 382
egervari Avatar asked Dec 04 '11 07:12

egervari


1 Answers

I was having a similar problem and i solved it configuring inputDir to point to the root directory of my js structure. By default, the plugin takes as base the parent directory of your output file, and includes will behave as relative to it (if not absolute paths).

<inputDir>src/main/js</inputDir>
<includes>
  <include>**/*.js</include>
</includes>
<output>${webapp.root.dir}/js/${project.artifactId}-${project.version}.js</output>

Hope this helps :)

like image 85
user1160722 Avatar answered Oct 04 '22 06:10

user1160722