davidB / yuicompressor-maven-plugin

maven's plugin to compress (Minify / Ofuscate / Aggregate) Javascript files and CSS files using YUI Compressor
http://davidb.github.io/yuicompressor-maven-plugin/
GNU Lesser General Public License v2.1
122 stars 48 forks source link

Cannot create resource output directory when searching for nested resources #57

Open mbakker2000 opened 12 years ago

mbakker2000 commented 12 years ago

Whem searching for nested resources (*/.css) a misparse folder can't be created;

[ERROR] Failed to execute goal net.alchim31.maven:yuicompressor-maven-plugin:1.3.0:compress (default) on project freak-core: Cannot create resource output directory: C:\${outputDirectory}\C:\${file.location} -> [Help 1]

Notice the C:\ in the path.

<plugin>
     <groupId>net.alchim31.maven</groupId>
     <artifactId>yuicompressor-maven-plugin</artifactId>
     <version>1.3.0</version>
     <executions>
         <execution>
             <phase>prepare-package</phase>
             <goals>
                 <goal>compress</goal>
             </goals>
         </execution>
     </executions>
     <configuration>
         <outputDirectory>${project.build.directory}/</outputDirectory>
         <sourceDirectory>${project.build.directory}/</sourceDirectory>
         <nosuffix>true</nosuffix>
         <includes>
             <include>**/*.css</include>
         </includes>
     </configuration>
</plugin>
pompiuses commented 11 years ago

Getting the same problem here on Windows7 and 8. Works fine on Ubuntu.

Windows error message: ERROR] Failed to execute goal net.alchim31.maven:yuicompressor-maven-plugin:1.3.2:compress (minifyJs) on project web-client: Cannot create resource output directory: C:\Users\blb\Work\publisher-imple entation-tool\web-client\target\js-min\C:\Users\blb\Work\publisher-implementation-tool\web-client\target -> [Help 1]

<plugin>
    <groupId>net.alchim31.maven</groupId>
    <artifactId>yuicompressor-maven-plugin</artifactId>
    <version>1.3.2</version>
    <configuration>
        <encoding>UTF-8</encoding>
    </configuration>
    <executions>
        <execution>
            <id>minifyJs</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>compress</goal>
            </goals>
            <configuration>
                <nosuffix>true</nosuffix>
                <sourceDirectory>js</sourceDirectory>
                <outputDirectory>${project.build.directory}/js-min</outputDirectory>
            </configuration>
        </execution>
        <execution>
            <id>minifyCss</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>compress</goal>
            </goals>
            <configuration>
                <nosuffix>true</nosuffix>
                <sourceDirectory>css</sourceDirectory>
                <outputDirectory>${project.build.directory}/css-min</outputDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>
davidB commented 11 years ago

can you run the command line with -e and copy/paste the stack trace ?

pompiuses commented 11 years ago

Here's the complete stack trace:

[DEBUG] compress file :C:\Users\BLB\Work\publisher-implementation-tool\web-client\config\build-number.js to C:\Users\BLB\Work\publisher-implementation-tool\web-client\target\js-min\C:\Users\BLB\Work\publisher-implementation-tool\web-client\target\build-number.js
[DEBUG] only compress if input file is younger than existing output file
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.626s
[INFO] Finished at: Fri Mar 22 17:03:09 CET 2013
[INFO] Final Memory: 17M/162M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal net.alchim31.maven:yuicompressor-maven-plugin:1.3.2:compress (minifyJs) on project web-client: Cannot create resource output directory: C:\Users\BLB\Work\publisher-implementation-tool\web-client\target\js-min\C:\Users\BLB\Work\publisher-implementation-tool\web-client\target -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal net.alchim31.maven:yuicompressor-maven-plugin:1.3.2:compress (minifyJs) on project web-client: Cannot create resource output directory: C:\Users\BLB\Work\publisher-implementation-tool\web-client\target\js-min\C:\Users\BLB\Work\publisher-implementation-tool\web-client\target
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot create resource output directory: C:\Users\BLB\Work\publisher-implementation-tool\web-client\target\js-min\C:\Users\BLB\Work\publisher-implementation-tool\web-client\target
        at net_alchim31_maven_yuicompressor.YuiCompressorMojo.processFile(YuiCompressorMojo.java:192)
        at net_alchim31_maven_yuicompressor.MojoSupport.processDir(MojoSupport.java:192)
        at net_alchim31_maven_yuicompressor.MojoSupport.execute(MojoSupport.java:135)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

Looking closer at the stack trace at line number 1 it says it's trying to compress /config/build-number.js even though the plugin is configured only to look in the /js folder (in my previous post). Seems like the plugin doesn't read both the sourceDirectory and outputDirectory correctly on Windows.

sjctrags commented 11 years ago

Any solution on this. It seems that am having similar problem

davidB commented 11 years ago

I didn't receive the previous notification. I'll take a look next week. Le 25 avr. 2013 07:23, "sjctrags" notifications@github.com a écrit :

Any solution on this. It seems that am having similar problem

— Reply to this email directly or view it on GitHubhttps://github.com/davidB/yuicompressor-maven-plugin/issues/57#issuecomment-16989249 .

sjctrags commented 11 years ago

here is mine:

Failed to execute goal net.alchim31.maven:yuicompressor-maven-plugin:1.3.0:compress (default) on project alfresco-mm-share: Cannot create resource output directory: D:\Projects\AfrescoSource\AlfrescoMM\alfresco-mm-share\target\classes\D:\Projects\AfrescoSource\AlfrescoMM\alfresco-mm-share\target\alfresco-mm-share-1.0-SNAPSHOT\web\mediamanagement\components\documentlibrary -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal net.alchim31.maven:yuicompressor-maven-plugin:1.3.0:compress (default) on project alfresco-mm-share: Cannot create resource output directory: D:\Projects\AfrescoSource\AlfrescoMM\alfresco-mm-share\target\classes\D:\Projects\AfrescoSource\AlfrescoMM\alfresco-mm-share\target\alfresco-mm-share-1.0-SNAPSHOT\web\mediamanagement\components\documentlibrary

if you see the path: Cannot create resource output directory: D:\Projects\AfrescoSource\AlfrescoMM\alfresco-mm-share\target\classes\D:\Projects\AfrescoSource\AlfrescoMM\alfresco-mm-share\target\alfresco-mm-share-1.0-SNAPSHOT\web\mediamanagement\components\documentlibrary

it is an invalid directory for windows....weird

slanglois commented 10 years ago

In my case, this (undocumented?) option fixed the problem, by only treating .js: <excludeResources>true</excludeResources>