3

So, there is a problem: i try to build assetic dumps with symfony2 on Windows machine through:

    php app/console assetic:dump

And then i get the following:

    [dir+] D:/Projects/domain/app/../web/js/compiled
    [file+] D:/Projects/domain/app/../web/js/compiled/main.js

    [Assetic\Exception\FilterException]
    An error occurred while running:
    "C:\Program Files\Java\jre7\bin\java.exe" "-jar" "D:/Projects/domain/app/Resources/java/yuicompressor-2.4.8.jar" "--charset" "UTF-8" "-o" "C:\Users\username\AppData\Local\Temp\YUIF039.tmp" "--type" "js" "C:\Users\username\AppData\Local\Temp\YUIF038.tmp"

    Error Output:
    java.io.FileNotFoundException: UsersusernameAppDataLocalTempYUIF039.tmp:\Users\username\AppData\Local\Temp\YUIF038.tmp (the filename,directory name, or volume label syntax is incorrect)

    Input:
    var a = 1;
    alert (a);

Folder "web/js/compiled" is created but stays empty. I can see "in real time" how YUIF03*.tmp files were created and removed during this operation in my TEMP folder. This problem takes place on both Windows machines i've tried, but I have no problems with this on Linux virtual machine. It seems like there is a problem with incorrect file path

    UsersusernameAppDataLocalTempYUIF039.tmp:\Users\username\AppData\Local\Temp\YUIF038.tmp

but i have no idea about the source of the problem (Java? YUICompressor? Symfony2? Assetic?)

Here are some configurations of my symfony2. composer.json:

"require": {
    "php": ">=5.3.3",
    "symfony/symfony": "2.3.*",
    "doctrine/orm": ">=2.2.3,<2.4-dev",
    "doctrine/doctrine-bundle": "1.2.*",
    "twig/extensions": "1.0.*",
    "symfony/assetic-bundle": "2.3.*",
    "symfony/swiftmailer-bundle": "2.3.*",
    "symfony/monolog-bundle": "2.3.*",
    "sensio/distribution-bundle": "2.3.*",
    "sensio/framework-extra-bundle": "2.3.*",
    "sensio/generator-bundle": "2.3.*",
    "incenteev/composer-parameter-handler": "~2.0"
},

config.yml:

    # Assetic Configuration
    assetic:
        debug:          %kernel.debug%
        use_controller: false
        bundles:        [ AcmeWebBundle ]
        java: C:\Program Files\Java\jre7\bin\java.exe
        filters:
            cssrewrite: ~
            yui_js:
                jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.8.jar

Any ideas?

Thanks!

4

2 回答 2

5

Same, it is a yui 2.4.8 error : https://github.com/yui/yuicompressor/issues/78

Just use 2.4.7 : https://github.com/yui/yuicompressor/downloads (the .jar is on the "build" folder).

java: "C:/Program Files (x86)/Java/jre7/bin/java.exe"
filters:
    yui_css:
        # 2.4.8 fail on windows
        jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"
于 2014-02-24T22:20:32.550 回答
1

I had the exact same problem. Not sure where it comes from, however, the symfony documentation indicates that "The YUI Compressor is going through a deprecation process." so it is probably not supported anymore.

I managed to get it to work by trying different JRE and yuicompressor.jar versions. Here is the assetic config that worked for me (Win7 64bits):

# Assetic config
assetic:
    debug:          %kernel.debug%
    use_controller: false
    bundles:        [ MyBundle ]
    java: C:\Program Files\Java\jre6\bin\java.exe
    filters:
        cssrewrite: ~
        yui_css:
            jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
        yui_js:
            jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar

Note the specific jre6 path (by default the jre installed on my machine was jre7 with which I get the error) and the 2.4.7 yuicompressor version (does not work with 2.4.8).

于 2013-07-16T10:20:16.160 回答