2016-12-28 23 views
2

我的应用程序在开发中运行良好。当我运行生产版本时,build.lib/www/app文件夹中缺少app.js。任何人都可以提供一些关于如何追踪我的构建出了什么问题的见解?JHipster gulp构建不生成用于生产的app.js

谢谢。

更新: 我遍历所有的gulpfile,试图理解正在发生的事情,最后得到在资产结束时调用的构建函数:prod任务。在该功能我更换了模板变量行

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

与测试字符串和它的作品。所以现在我正在研究哪些模板导致问题。多么痛苦。有没有一种方法可以让你获得更多的信息,比如错误发生地点附近的一些字符?

./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 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 

回答

1

的一次尝试每一个模板,一个几个小时后,我终于发现了问题作为模板是一个错字那里是美元而不是美元。这在构建函数中的JS相关子任务中抛出了模糊的错误。

+0

我有同样的问题。你究竟“一次尝试一个模板”? –

+0

gulp构建过程的一部分会生成一个角度模板缓存文件,该文件位于您的项目根目录build/tmp/templates.js中。如果我没有记错的话,在gulpfile.js的“html”任务中完成。您可以尝试构建一次,以便生成templates.js,然后注释构建​​过程的该部分,以便不会重新生成该文件。然后在templates.js中,注释掉除第一行以外的所有$ templateCache.put行,然后重新运行构建。如果成功,则取消注释下一行并重新构建,直到找到导致构建失败的模板。 –

0

如果您打开gulpfile.js,则会有一个名为'html'的吞食任务。 如果运行键入“一饮而尽HTML”从终端这个任务它会生成一个名为“templates.js”在“目标的/ tmp”文件夹文件。 此文件有多个$ templateCache.put行。 其中一行可能会导致错误。 在PROD配置文件中运行您的应用程序,并使服务器保持运行

删除几乎所有的$ templateCache.put行,除了templates.js中的主页行,并运行'gulp build'。 现在很难提及浏览器,并检查您是否能够看到主页。 如果主页和其他行不会导致错误,您将看到主页。

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

重复此过程,直到罚款导致问题的行。

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

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

希望这会有所帮助。