【问题标题】:Error for deploying to heroku: illegal character: '\ufeff'部署到 heroku 时出错:非法字符:'\ufeff'
【发布时间】:2020-05-06 12:17:45
【问题描述】:

全部。

我正在测试在 Heroku 中开发 Web 应用程序是否有用。所以,我正在尝试遵循“将 Spring Boot 应用程序部署到 Heroku”的指南。(链接:https://devcenter.heroku.com/articles/deploying-spring-boot-apps-to-heroku) 我可以按照指南检查返回 hello world 的页面,但我在连接 postgresql 时遇到问题。当我尝试将 DatabaseConfig.java 文件部署到 git 时,它会失败并在 vscode 中显示以下日志。我该如何解决?

$ git push heroku master
Enumerating objects: 24, done.
Counting objects: 100% (24/24), done.   
Delta compression using up to 12 threads
Compressing objects: 100% (12/12), done.
Writing objects: 100% (15/15), 1.36 KiB | 463.00 KiB/s, done.
Total 15 (delta 3), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Java app detected
remote: -----> Installing JDK 1.8... done
remote: -----> Executing Maven
remote:        $ ./mvnw -DskipTests clean dependency:list install
remote:        [INFO] Scanning for projects...
remote:        [INFO]
remote:        [INFO] -------------------------< com.daview:daview >--------------------------
remote:        [INFO] Building demo 0.0.1-SNAPSHOT
remote:        [INFO] --------------------------------[ jar ]---------------------------------
remote:        [INFO] 
remote:        [INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ daview ---
remote:        [INFO] 
remote:        [INFO] --- maven-dependency-plugin:3.1.2:list (default-cli) @ daview ---
remote:        [INFO] 
remote:        [INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ daview ---
remote:        [INFO] Using 'UTF-8' encoding to copy filtered resources.
remote:        [INFO] Copying 1 resource
remote:        [INFO] Copying 0 resource
remote:        [INFO]
remote:        [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ daview ---
remote:        [INFO] Changes detected - recompiling the module!
remote:        [INFO] Compiling 2 source files to /tmp/build_d5a7a4a08b5f6a2624f3313e54f0a54a/target/classes
remote:        [INFO] -------------------------------------------------------------
remote:        [ERROR] COMPILATION ERROR :
remote:        [INFO] -------------------------------------------------------------
remote:        [ERROR] /tmp/build_d5a7a4a08b5f6a2624f3313e54f0a54a/src/main/java/com/daview/daview/DatabaseConfig.java:[1,1] illegal character: '\ufeff'
remote:        [ERROR] /tmp/build_d5a7a4a08b5f6a2624f3313e54f0a54a/src/main/java/com/daview/daview/DatabaseConfig.java:[1,10] class, interface, or enum expected
remote:        [INFO] 2 errors
remote:        [INFO] -------------------------------------------------------------
remote:        [INFO] ------------------------------------------------------------------------
remote:        [INFO] BUILD FAILURE
remote:        [INFO] ------------------------------------------------------------------------
remote:        [INFO] Total time:  4.196 s
remote:        [INFO] Finished at: 2020-05-05T17:33:46Z
remote:        [INFO] ------------------------------------------------------------------------
remote:        [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project daview: Compilation failure: Compilation failure:
remote:        [ERROR] /tmp/build_d5a7a4a08b5f6a2624f3313e54f0a54a/src/main/java/com/daview/daview/DatabaseConfig.java:[1,1] illegal character: '\ufeff'
remote:        [ERROR] /tmp/build_d5a7a4a08b5f6a2624f3313e54f0a54a/src/main/java/com/daview/daview/DatabaseConfig.java:[1,10] class, interface, or enum expected
remote:        [ERROR] -> [Help 1]
remote:        [ERROR]
remote:        [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
remote:        [ERROR] Re-run Maven using the -X switch to enable full debug logging.
remote:        [ERROR]
remote:        [ERROR] For more information about the errors and possible solutions, please read the following articles:
remote:        [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
remote:
remote:  !     ERROR: Failed to build app with Maven
remote:        We're sorry this build is failing! If you can't find the issue in application code,
remote:        please submit a ticket so we can help: https://help.heroku.com/
remote:
remote:  !     Push rejected, failed to compile Java app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to daview.
remote:
To https://git.heroku.com/daview.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/daview.git'

【问题讨论】:

    标签: heroku heroku-postgres


    【解决方案1】:

    我找到了解决方案!
    这是编码的问题!
    我可以通过更改编码类型(如 EUC-KR 而不是 UTF)找到“\ufeff”字符。所以我正确地修复了代码并保存回 utf-8。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-04-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-11
      • 2018-06-05
      相关资源
      最近更新 更多