Java Valo主题编译错误

Java Valo主题编译错误,java,sass,Java,Sass,我试图建立一个简单的侧菜单,就像在他们的演示应用程序。 我看了他们关于主题的网络研讨会视频。我的应用程序包含一个带有3个菜单项的菜单栏。创建菜单栏后,我添加了一个自定义样式,并根据valo menubar的vaadin API定义了对象 当尝试调试构建时,我得到以下错误 [ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:8.0.5:compile-theme (default-cli) on project myappli

我试图建立一个简单的侧菜单,就像在他们的演示应用程序。 我看了他们关于主题的网络研讨会视频。我的应用程序包含一个带有3个菜单项的菜单栏。创建菜单栏后,我添加了一个自定义样式,并根据valo menubar的vaadin API定义了对象

当尝试调试构建时,我得到以下错误

[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]
这是完整的错误日志

[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
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;
    }
}

}

您发布的SCS存在多个问题,但我认为主要问题只是您不需要将整个
valo menubar
mixin定义复制到
@include
语句中。您只需要mixin名称及其参数。因此,您的代码将简化为:

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

@mixin mytheme {
    @include valo;

    .v-menubar-custom {
        @include valo-menubar($primary-stylename: v-menubar, $include-additional-styles: false);
    }
}
然而,我也不确定这是否是你想要的。鉴于您正在将样式名称“custom”应用于菜单栏,这可能对您有用:

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

@mixin mytheme {
    @include valo;

    @include valo-menubar($primary-stylename: v-menubar-custom, $include-additional-styles: false);
}
除此之外,mixin定义没有正确复制。结尾处缺少一个右大括号,最后一个
@include
语句后面有一个破折号,以及其他几个复制错误。有关详细信息,请参阅

如果要基于
valo menubar
创建自定义mixin,则需要使用
@mixin
关键字(最好在mytheme mixin之外,在单独的文件中)以
valo menubar
以外的名称单独定义它,然后使用
@include
将其包含,正如我在上面演示的那样


希望这能有所帮助。

问题是什么?mytheme.scss中的语法错误在哪里?因为删除了“v-menubar-custom”的定义后,它可以正常编译。是否与我们共享错误消息?您的帖子,包括所有相关信息。抱歉,错误日志在pastebin linkI中。我已将日志移到帖子中。关键信息的外部链接没有用处,因为它们可能会坏掉,使问题变得无用。
@import "../valo/valo.scss";

@mixin mytheme {
    @include valo;

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