8

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.

4

1 回答 1

12

我遇到了类似的问题,我解决了它,将 inputDir 配置为指向我的 js 结构的根目录。默认情况下,插件将输出文件的父目录作为基础,并且包含将表现为相对于它(如果不是绝对路径)。

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

希望这可以帮助 :)

于 2012-01-20T13:35:48.537 回答