简体   繁体   中英

Symfony2 app/console assetic:dump - An error occurred while running:

I am trying to run assetic:dump on Windows in Symfony2 Project. I have downloaded yuicompressor-2.4.8.jar and place it to app/Resources/java/ folder.

Next i have created the {% stylesheets %} block in my twig templet as in example below:

{% stylesheets 
    'bundles/arsen/css/style.css'
    filter='cssrewrite, yui_css'
    output='assets/css/complied.css'
%}
    <link rel="stylesheet" type="text/css" href="{{ asset_url }}">
{% endstylesheets %}

This is my app/config/config.yml :

assetic:
    debug:          "%kernel.debug%"
    use_controller: false
    bundles:        [ MyBundle ]
    java: C:\Program Files (x86)\Java\jre1.8.0_73\bin\java.exe
    filters:
        cssrewrite: ~
        yui_css:
            jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.8.jar"

When I run app/console assetic:dump i get this error:

  [Assetic\Exception\FilterException]                                                                                                                                                                             
  An error occurred while running:                                                                                                                                                                                
  "C:\Program Files (x86)\Java\jre1.8.0_73\bin\java.exe" "-jar" "C:\xampp\htdocs\Symfony27\app/Resources/java/yuicompressor-2.4.8.jar" "--charset" "UTF-8" "-o" "C:\Users\SYMFONY\AppData\Local\Temp\assD12A.tmp" "--type" "css" "C:\Users\SYMFONY\AppData\Local\Temp\assD129.tmp"
  Error Output:                                                                                                                                                                                                   
  java.io.FileNotFoundException: UsersSYMFONYAppDataLocalTempassD12A.tmp:\Users\SYMFONY\AppData\Local\Temp\assD129.tmp (The filename, directory name, or volume label syntax is incorrect)                        
        at java.io.FileOutputStream.open0(Native Method)                                                                                                                                                          
        at java.io.FileOutputStream.open(Unknown Source)                                                                                                                                                          
        at java.io.FileOutputStream.<init>(Unknown Source)                                                                                                                                                        
        at java.io.FileOutputStream.<init>(Unknown Source)                                                                                                                                                        
        at com.yahoo.platform.yui.compressor.YUICompressor.main(YUICompressor.java:208)                                                                                                                           
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                                                                                                                                            
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)                                                                                                                                            
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)                                                                                                                                        
        at java.lang.reflect.Method.invoke(Unknown Source)                                                                                                                                                        
        at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)   

Can this be caused by some incompatybility with java version "1.8.0_73" and java version "1.8.0_73" file ?

It seem to be the java path. Try something like this and adjust to your path:

assetic: 
    java: "C://Program Files//Java//jre1.8.0_31//bin//java.exe"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM