JHipster gulp build未生成用于生产的app.js

JHipster gulp build未生成用于生产的app.js,jhipster,Jhipster,我的应用程序在开发中运行良好。运行生产构建时,build/lib/www/app文件夹中缺少app.js。有人能提供一些关于如何追踪我的构建出了什么问题的见解吗 谢谢 更新: 我浏览了所有的gulpfile文件,试图了解发生了什么,最后找到了在assets:prod任务末尾调用的build函数。在该函数中,我替换了行中的templates变量 .pipe(gulpIf('**/app.js',页脚(模板))) 使用测试字符串,它可以工作。所以现在我要找出是哪个模板导致了这个问题。多痛苦啊。有没有

我的应用程序在开发中运行良好。运行生产构建时,build/lib/www/app文件夹中缺少app.js。有人能提供一些关于如何追踪我的构建出了什么问题的见解吗

谢谢

更新: 我浏览了所有的gulpfile文件,试图了解发生了什么,最后找到了在assets:prod任务末尾调用的build函数。在该函数中,我替换了行中的templates变量

.pipe(gulpIf('**/app.js',页脚(模板)))

使用测试字符串,它可以工作。所以现在我要找出是哪个模板导致了这个问题。多痛苦啊。有没有办法让gulp向您提供更多的信息,例如错误发生地附近的一些字符

./gradlew -Pprod clean bootRepackage
    Starting a Gradle Daemon (subsequent builds will be faster)
    The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
            at gatling_b4a4yvzsw9z41nm1decp5w4n3.run(/Users/jreymann/projects-java/us.netblue/gradle/gatling.gradle:23)
    :clean
    :cleanResources UP-TO-DATE
    :bootBuildInfo
    :bower
    :nodeSetup SKIPPED
    :npmSetup SKIPPED
    :npmInstall UP-TO-DATE
    :gulpBuildWithOpts
    [12:29:58] Using gulpfile ~/projects-java/us.netblue/gulpfile.js
    [12:29:58] Starting 'clean'...
    [12:29:58] Finished 'clean' after 4.63 ms
    [12:29:58] Starting 'build'...
    [12:29:58] Starting 'copy:fonts'...
    [12:29:58] Starting 'copy:common'...
    [12:29:58] Starting 'inject:vendor'...
    [12:29:58] Starting 'ngconstant:prod'...
    [12:29:58] Finished 'ngconstant:prod' after 23 ms
    [12:29:58] gulp-inject 1 files into vendor.scss.
    [12:29:58] Finished 'copy:common' after 78 ms
    [12:29:58] gulp-inject 19 files into index.html.
    [12:29:58] Finished 'inject:vendor' after 79 ms
    [12:29:58] Finished 'copy:fonts' after 98 ms
    [12:29:58] Starting 'copy'...
    [12:29:58] Finished 'copy' after 19 μs
    [12:29:58] Starting 'inject:app'...
    [12:29:58] gulp-inject 143 files into index.html.
    [12:29:58] Finished 'inject:app' after 168 ms
    [12:29:58] Starting 'inject:troubleshoot'...
    [12:29:58] gulp-inject Nothing to inject into index.html.
    [12:29:58] Finished 'inject:troubleshoot' after 2.07 ms
    [12:29:58] Starting 'images'...
    [12:29:58] Starting 'sass'...
    [12:29:58] Starting 'html'...
    [12:29:58] Starting 'copy:swagger'...
    [12:29:58] Starting 'copy:images'...
    [12:29:58] Finished 'copy:images' after 8.98 ms
    [12:29:59] Tested 18 tests, 18 passes, 0 failures: PASS
    [12:29:59] gulp-imagemin: Minified 6 images (saved 6.79 kB - 17%)
    [12:29:59] Finished 'images' after 459 ms
    [12:29:59] Finished 'sass' after 492 ms
    [12:29:59] Starting 'styles'...
    [12:29:59] Finished 'styles' after 2.21 ms
    [12:29:59] Finished 'html' after 527 ms
    [12:29:59] Finished 'copy:swagger' after 527 ms
    [12:29:59] Starting 'assets:prod'...
    [12:30:12] Finished 'assets:prod' after 13 s
    [12:30:12] Finished 'build' after 14 s
    :processResources
    :compileJava
    [Fatal Error] shrinkwrap-descriptors-bom-2.0.0-alpha-3.pom:130:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    [Fatal Error] shrinkwrap-descriptors-bom-2.0.0-alpha-3.pom:130:6: The processing instruction target matching "[xX][mM][lL]" is not allowed.
    [Fatal Error] commons-lang3-3.4.pom:772:1: Content is not allowed in trailing section.
    [Fatal Error] commons-parent-39.pom:1506:5: The markup in the document following the root element must be well-formed.
    [Fatal Error] commons-lang3-3.4.pom:772:1: Content is not allowed in trailing section.
    [Fatal Error] commons-parent-39.pom:1506:5: The markup in the document following the root element must be well-formed.
    [Fatal Error] commons-lang3-3.4.pom:772:1: Content is not allowed in trailing section.
    :compileScala UP-TO-DATE
    :classes
    :findMainClass
    :war
    [Fatal Error] commons-lang3-3.4.pom:772:1: Content is not allowed in trailing section.
    [Fatal Error] commons-lang3-3.4.pom:772:1: Content is not allowed in trailing section.
    :bootRepackage

    BUILD SUCCESSFUL
如果我单独运行gulp构建,我会得到:

gulp build
    [12:05:12] Using gulpfile ~/projects-java/us.netblue/gulpfile.js
    [12:05:12] Starting 'clean'...
    [12:05:12] Finished 'clean' after 21 ms
    [12:05:12] Starting 'build'...
    [12:05:12] Starting 'copy:fonts'...
    [12:05:12] Starting 'copy:common'...
    [12:05:12] Starting 'inject:vendor'...
    [12:05:12] Starting 'ngconstant:prod'...
    [12:05:12] Finished 'ngconstant:prod' after 25 ms
    [12:05:12] gulp-inject 1 files into vendor.scss.
    [12:05:12] Finished 'copy:common' after 80 ms
    [12:05:12] gulp-inject 19 files into index.html.
    [12:05:12] Finished 'inject:vendor' after 80 ms
    [12:05:12] Finished 'copy:fonts' after 104 ms
    [12:05:12] Starting 'copy'...
    [12:05:12] Finished 'copy' after 24 μs
    [12:05:12] Starting 'inject:app'...
    [12:05:13] gulp-inject 143 files into index.html.
    [12:05:13] Finished 'inject:app' after 179 ms
    [12:05:13] Starting 'inject:troubleshoot'...
    [12:05:13] gulp-inject Nothing to inject into index.html.
    [12:05:13] Finished 'inject:troubleshoot' after 2.19 ms
    [12:05:13] Starting 'images'...
    [12:05:13] Starting 'sass'...
    [12:05:13] Starting 'html'...
    [12:05:13] Starting 'copy:swagger'...
    [12:05:13] Starting 'copy:images'...
    [12:05:13] Finished 'copy:images' after 7.44 ms
    [12:05:13] Tested 18 tests, 18 passes, 0 failures: PASS
    [12:05:13] gulp-imagemin: Minified 6 images (saved 6.79 kB - 17%)
    [12:05:13] Finished 'images' after 439 ms
    [12:05:13] Finished 'sass' after 483 ms
    [12:05:13] Starting 'styles'...
    [12:05:13] Finished 'styles' after 1.42 ms
    [12:05:13] Finished 'html' after 511 ms
    [12:05:13] Finished 'copy:swagger' after 514 ms
    [12:05:13] Starting 'assets:prod'...
    [12:05:26] gulp-notify: [JHipster Gulp Build] Error: Unexpected token .
    [12:05:26] Finished 'assets:prod' after 13 s
    [12:05:26] Finished 'build' after 14 s

每次尝试一个模板几个小时后,我终于发现问题在于模板中有一个拼写错误,模板中有一个$而不是$。这在构建函数中的JS相关子任务中引发了模糊错误。

如果打开gulpfile.JS,则有一个名为“html”的gulp任务。 如果您通过键入“gulp html”从终端运行此任务,它将在'target/tmp'文件夹中生成名为'templates.js'的文件。 此文件有多行$templateCache.put。 其中一行可能导致错误。 在产品配置文件中运行应用程序,并保持服务器运行

删除templates.js中几乎所有的$templateCache.put行(主页行除外),然后运行'gulpbuild'。 现在硬引用浏览器,检查您是否能够看到主页。 如果主页和其他行没有导致错误,您将看到主页

现在,将一些已删除的$templateCache.put行添加回templates.js,并再次运行“gulp build”

重复此过程,直到找到导致问题的线为止

一旦你发现这一行,检查它提到的html页面,并尝试删除该html文件中的所有注释

该html文件中的某些代码可能导致该问题


希望这有帮助。

我也有同样的问题。您是如何“一次尝试一个模板”的?gulp构建过程的一部分会生成一个角度模板缓存文件,该文件位于build/tmp/templates.js的项目根目录中。如果我没记错的话,这是在gulpfile.js中的“html”任务中完成的。您可以尝试构建一次,以便生成templates.js,然后注释掉构建过程的这一部分,这样文件就不会重新生成。然后在templates.js中,注释掉除第一行之外的所有$templateCache.put行,然后重新运行构建。如果成功,则取消对下一行的注释并再次构建,依此类推,直到找到导致构建失败的模板。哇!我在jhipster使用旧angularjs生成的应用程序中遇到了这个问题,问题是我使用“let”定义了一个变量。虽然它在开发过程中起作用——运行mvn和gulp,但一旦我
mvn-Pprod包
并部署到服务器上,它就不起作用了。一旦我将“let”变量声明替换为“var”,它就可以顺利运行了。