about 1 year ago

circleci 上的 gradle 是蠻舊的版本了,新版的 Springboot plugin 不太支援這麼舊版所以導致打包都一直失敗。

在 circle.yml 自己更新 gradle 版本

circle.yml
machine:

  environment:

    PATH: "~/$CIRCLE_PROJECT_REPONAME/gradle-3.2.1/bin:$PATH"

  services:

    - docker

  java:

    version: oraclejdk8


dependencies:

  pre:

    - wget "https://services.gradle.org/distributions/gradle-3.2.1-bin.zip"; unzip gradle-3.2.1-bin.zip

#    - chmod +x gradlew

  override:

    - docker info


deployment:

  hub:

    branch: master

    commands:

      - gradle build && cp -R build/libs $CIRCLE_ARTIFACTS

      - docker build -t "spike234/bookservice:$CIRCLE_BUILD_NUM" .

      - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS

      - docker push "spike234/bookservice:$CIRCLE_BUILD_NUM"

喔對, circleci 會判斷如果你有 gradlew 會先執行,會有錯

Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain

所以不要上傳 gradlew 因為好像還需要額外配置,目前是無法正常打包,不過機器上都已經有了新版就用新版吧

← Configuration meta-data in Spring Boot Java NIO read write →
 
comments powered by Disqus