2017-04-16 5 views
-3

Ich versuche, ein einfaches Side-Menü wie in ihrer Demo-App zu bauen. Ich sah ihr Webinar-Video über die Thematik. Meine App enthält eine Menüleiste mit 3 Menüpunkten. Nachdem ich die Menüleiste erstellt habe, füge ich einen benutzerdefinierten Stil hinzu und definiere das Objekt gemäß der vaadin API für Valo-Menüleiste.Valo Thema Kompilierung Fehler

Wenn die Build zu debuggen ich versucht, die folgende Fehlermeldung erhalten

[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:8.0.5:compile-theme (default-cli) on project myapplication: Compiling theme "VAADIN\themes\mytheme" failed: Command [[ 

[ERROR] C:\Program Files\Java\jre1.8.0_121\bin\java -Xmx1G 
com.vaadin.sass.SassCompiler "path-to-styles.css" 
"path-to-mytheme.scss" 

[ERROR] ]] failed with status 1 

[ERROR] -> [Help 1] 

hier ist die vollständige Fehlerprotokoll

[INFO] Error stacktraces are turned on. 
[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building myapplication 1.0-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] >>> jetty-maven-plugin:9.3.9.v20160517:run (default-cli) > test-compile @ myapplication >>> 
[INFO] 
[INFO] --- vaadin-maven-plugin:8.0.5:update-theme (default) @ myapplication --- 
[INFO] Updating theme VAADIN\themes\mytheme 
[INFO] Widgetsets found from classpath: 
[INFO] Addon styles found from classpath: 
[INFO] 
[INFO] Search took 7ms 
[INFO] Theme "VAADIN\themes\mytheme" updated 
[INFO] 
[INFO] --- vaadin-maven-plugin:8.0.5:update-widgetset (default) @ myapplication --- 
[WARNING] GWT plugin is configured to detect modules, but none were found. 
[INFO] No widgetsets found - generating AppWidgetset if necessary. 
[INFO] Updating widgetset AppWidgetset 
[INFO] Adding resource directory to command classpath: C:\Users\Maddie\workspace\myapplication\src\main\resources 
[INFO] Adding resource directory to command classpath: C:\Users\Maddie\workspace\myapplication\target\generated-resources\gwt 
[INFO] Using com.vaadin:vaadin-client version 8.0.5 
[INFO] Using com.vaadin:vaadin-client-compiler version 8.0.5 
[INFO] Widgetsets found from classpath: 
[INFO] com.vaadin.DefaultWidgetSet in jar:file:C:/Users/Maddie/.m2/repository/com/vaadin/vaadin-client/8.0.5/vaadin-client-8.0.5.jar!/ 
[INFO] Addon styles found from classpath: 
[INFO] 
[INFO] Search took 4ms 
[INFO] 
[INFO] --- vaadin-maven-plugin:8.0.5:compile-theme (default) @ myapplication --- 
[INFO] Updating theme VAADIN\themes\mytheme 
[ERROR] Apr 15, 2017 9:04:13 PM com.vaadin.sass.internal.handler.SCSSErrorHandler severe 
[ERROR] SEVERE: null 
[ERROR] com.vaadin.sass.internal.parser.SCSSParseException: Error when parsing file mytheme.scss 
[ERROR] Encountered "<EOF>" at line 82, column 2. 
[ERROR] Was expecting one of: 
[ERROR]  <S> ... 
[ERROR]  "}" ... 
[ERROR]  "+" ... 
[ERROR]  "-" ... 
[ERROR]  ">" ... 
[ERROR]  "~" ... 
[ERROR]  "[" ... 
[ERROR]  "*" ... 
[ERROR]  "%" ... 
[ERROR]  "&" ... 
[ERROR]  "." ... 
[ERROR]  "and" ... 
[ERROR]  "or" ... 
[ERROR]  "not" ... 
[ERROR]  ":" ... 
[ERROR]  "#{" ... 
[ERROR]  "through" ... 
[ERROR]  "in" ... 
[ERROR]  "@include" ... 
[ERROR]  "@debug" ... 
[ERROR]  "@warn" ... 
[ERROR]  "@for" ... 
[ERROR]  "@each" ... 
[ERROR]  "@while" ... 
[ERROR]  "@if" ... 
[ERROR]  "@extend" ... 
[ERROR]  "@content" ... 
[ERROR]  <MICROSOFT_RULE> ... 
[ERROR]  <IDENT> ... 
[ERROR]  <VARIABLE> ... 
[ERROR]  <HASH> ... 
[ERROR]  "@media" ... 
[ERROR]  "@page" ... 
[ERROR]  "@font-face" ... 
[ERROR]  <KEY_FRAME_SYM> ... 
[ERROR]  <ATKEYWORD> ... 
[ERROR]  
[ERROR]  at com.vaadin.sass.internal.ScssStylesheet.get(ScssStylesheet.java:176) 
[ERROR]  at com.vaadin.sass.internal.visitor.ImportNodeHandler.traverse(ImportNodeHandler.java:68) 
[ERROR]  at com.vaadin.sass.internal.tree.ImportNode.traverse(ImportNode.java:99) 
[ERROR]  at com.vaadin.sass.internal.tree.Node.traverseChildren(Node.java:227) 
[ERROR]  at com.vaadin.sass.internal.tree.Node.traverseChildren(Node.java:214) 
[ERROR]  at com.vaadin.sass.internal.ScssStylesheet.traverse(ScssStylesheet.java:298) 
[ERROR]  at com.vaadin.sass.internal.ScssStylesheet.compile(ScssStylesheet.java:267) 
[ERROR]  at com.vaadin.sass.SassCompiler.main(SassCompiler.java:101) 
[ERROR] 
[ERROR] Apr 15, 2017 9:04:13 PM com.vaadin.sass.internal.handler.SCSSErrorHandler severe 
[ERROR] SEVERE: Mixin Definition: mytheme not found 
[ERROR] Compiling theme "VAADIN\themes\mytheme" failed 
org.codehaus.mojo.gwt.shell.JavaCommandException: Command [[ 
C:\Program Files\Java\jdk1.8.0_121\jre\bin\java -Xmx1G com.vaadin.sass.SassCompiler C:\Users\Maddie\workspace\myapplication\src\main\webapp\VAADIN\themes\mytheme\styles.scss C:\Users\Maddie\workspace\myapplication\src\main\webapp\VAADIN\themes\mytheme\styles.css 
]] failed with status 1 
    at org.codehaus.mojo.gwt.shell.JavaCommand.execute(JavaCommand.java:330) 
    at com.vaadin.integration.maven.CompileThemeMojo.processTheme(CompileThemeMojo.java:65) 
    at com.vaadin.integration.maven.AbstractThemeMojo.doExecute(AbstractThemeMojo.java:43) 
    at org.codehaus.mojo.gwt.shell.AbstractGwtShellMojo.execute(AbstractGwtShellMojo.java:182) 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) 
    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.MojoExecutor.executeForkedExecutions(MojoExecutor.java:352) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:197) 
    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:116) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) 
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) 
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) 
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) 
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) 
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:498) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 3.269 s 
[INFO] Finished at: 2017-04-15T21:04:13-05:00 
[INFO] Final Memory: 14M/313M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:8.0.5:compile-theme (default) on project myapplication: Compiling theme "VAADIN\themes\mytheme" failed: Command [[ 
[ERROR] C:\Program Files\Java\jdk1.8.0_121\jre\bin\java -Xmx1G com.vaadin.sass.SassCompiler C:\Users\Maddie\workspace\myapplication\src\main\webapp\VAADIN\themes\mytheme\styles.scss C:\Users\Maddie\workspace\myapplication\src\main\webapp\VAADIN\themes\mytheme\styles.css 
[ERROR] ]] failed with status 1 
[ERROR] -> [Help 1] 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.vaadin:vaadin-maven-plugin:8.0.5:compile-theme (default) on project myapplication: Compiling theme "VAADIN\themes\mytheme" failed 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) 
    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.MojoExecutor.executeForkedExecutions(MojoExecutor.java:352) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:197) 
    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:116) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) 
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) 
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) 
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) 
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) 
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:498) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) 
Caused by: org.apache.maven.plugin.MojoExecutionException: Compiling theme "VAADIN\themes\mytheme" failed 
    at com.vaadin.integration.maven.CompileThemeMojo.processTheme(CompileThemeMojo.java:69) 
    at com.vaadin.integration.maven.AbstractThemeMojo.doExecute(AbstractThemeMojo.java:43) 
    at org.codehaus.mojo.gwt.shell.AbstractGwtShellMojo.execute(AbstractGwtShellMojo.java:182) 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) 
    ... 24 more 
Caused by: org.codehaus.mojo.gwt.shell.JavaCommandException: Command [[ 
C:\Program Files\Java\jdk1.8.0_121\jre\bin\java -Xmx1G com.vaadin.sass.SassCompiler C:\Users\Maddie\workspace\myapplication\src\main\webapp\VAADIN\themes\mytheme\styles.scss C:\Users\Maddie\workspace\myapplication\src\main\webapp\VAADIN\themes\mytheme\styles.css 
]] failed with status 1 
    at org.codehaus.mojo.gwt.shell.JavaCommand.execute(JavaCommand.java:330) 
    at com.vaadin.integration.maven.CompileThemeMojo.processTheme(CompileThemeMojo.java:65) 
    ... 28 more 
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[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 

Gibt es einen Syntaxfehler in mytheme.scss? Ohne die Definition für "v-menubar-custom" läuft das Programm gut.

MyUI.java

@Theme("mytheme") 
public class MyUI extends UI { 

private static final String CUSTOM = "custom"; 

@Override 
protected void init(VaadinRequest vaadinRequest) { 
    final VerticalLayout layout = new VerticalLayout(); 

    MenuBar nav = new MenuBar(); 

    MenuItem overview = nav.addItem("Overview", null, null); 
    MenuItem clients = nav.addItem("Clients", null, null); 
    MenuItem calendar = nav.addItem("Calendar", null, null); 

    nav.addStyleName(CUSTOM); 


    layout.addComponent(nav); 

    setContent(layout); 
} 

@WebServlet(urlPatterns = "/*", name = "MyUIServlet", asyncSupported = true) 
@VaadinServletConfiguration(ui = MyUI.class, productionMode = false) 
public static class MyUIServlet extends VaadinServlet { 
} 
} 

mytheme.scss

@import "../valo/valo.scss"; 

@mixin mytheme { 
@include valo; 

.v-menubar-custom { 
@include valo-menubar($primary-stylename: v-menubar, $include-additional-styles) { 
    .#{$primary-stylename} { 
     @include valo-button-static-style($states: normal focus disabled, $vertical-centering: false); 
     @include valo-menubar-style; 
    } 
    .#{$primary-stylename}:activate:after { 
     background: transparent; 
    } 
    .#{$primary-stylename} > .#{$primary-stylename}-menuitem { 
     @include valo-menubar-menuitem-style; 
    } 
    .#{$primary-stylename} > .#{$primary-stylename}-menuitem-checked { 
     @include valo-menubar-menuitem-checked-style; 
    } 

    .v-disabled > .#{$primary-stylename}-menuitem, 
    .#{$primary-stylename} > .#{$primary-stylename}-menuitem-disabled { 
     cursor: default; 
    } 

    &:before { 
     display: none; 
    } 
} 

.#{$primary-stylename}-menuitem-disabled { 
    @include opacity($v-disabled-opacity); 
} 

.#{$primary-stylename} > .#{$primary-stylename}-menuitem-selected { 
    @include valo-button-style($states: normal, $background-color: $v-selection-color, $border-radius: 0, $shadow: null, $unit-size: null, $font-weight: null); 
    border-top-width: 0; 
    border-left-width: 0; 
    border-bottom-width: 0; 
    z-index: 2; 

    &:hover:before { 
     background: none; 
    } 
} 

.#{$primary-stylename} .#{$primary-stylename}-submenu-indicator { 
    display: none; 

    + .#{$primary-stylename}-menuitem-caption:after { 
     font-family: FontAwesome; 
     content: "\f078"; 
     font-size: 0.7em; 
     vertical-align: .15em; 
     margin: 0 -.2em 0 .5em; 
     //IE filters are not supported on pseudo elements 
     opacity: .5; 
    } 

    + .#{$primary-stylename}-menuitem-caption:empty:after { 
     margin-left: -.2em; 
    } 
} 

.#{$primary-stylename}-popup { 
    @include valo-menubar-popup-style($primary-stylename) 
} 

@if $include-additional-styles { 
    .#{$primary-stylename}-small { 
     @include valo-menubar-style($background-color: null, $unit-size: $v-unit-size--small); 
     font-size: $v-font-size--small; 
    } 

    .#{$primary-stylename}-borderless { 
     @include-valo-menubar-borderless-style; 
    } 
} 

} 
+0

Was ist die Frage? –

+0

wo ist der Syntaxfehler in mytheme.scss, wie es gut kompiliert, wenn die Definition für "v-menubar-custom" entfernt wird. – mirGantrophy

+1

Möchten Sie die Fehlermeldung mit uns teilen? [bearbeiten] Sie Ihren Beitrag und fügen Sie ALLE relevanten Informationen hinzu. –

Antwort

2

Es gibt mehrere Probleme mit dem SCSS Sie auf dem Laufenden, aber ich denke, dass das primäre Problem, dass man einfach ist don Sie müssen nicht die gesamte valo-menubar Mixin-Definition in Ihre @include Anweisung kopieren. Alles, was Sie brauchen, ist der Mix-Name und seine Argumente. So würde Ihr Code vereinfachen zu:

@import "../valo/valo.scss"; 

@mixin mytheme { 
    @include valo; 

    .v-menubar-custom { 
     @include valo-menubar($primary-stylename: v-menubar, $include-additional-styles: false); 
    } 
} 

Allerdings bin ich nicht genau sicher, ob das ist, was Sie wollen. Vorausgesetzt, dass Sie die Artnamen „custom“ auf Ihre menubar anwenden, vielleicht wäre dies für Sie arbeitet:

@import "../valo/valo.scss"; 

@mixin mytheme { 
    @include valo; 

    @include valo-menubar($primary-stylename: v-menubar-custom, $include-additional-styles: false); 
} 

Abgesehen davon wird die mixin Definition nicht korrekt kopiert. Sie fehlen eine schließende geschweifte Klammer am Ende, Sie haben einen Strich nach der letzten @include Anweisung und mehrere andere Kopierfehler. Details finden Sie unter mixin documentation.

Wenn Sie eine benutzerdefinierte mixin basierend auf valo-menubar erstellen möchten, müssen Sie es separat definieren, mit dem @mixin Schlüsselwort (vorzugsweise außerhalb des mytheme mixin und in einer separaten Datei) mit einem anderen Namen als valo-menubar und dann @include es wie ich oben gezeigt habe.

Hoffe, das hilft.