簡體   English   中英

在 Bitbucket Pipeline 中集成 Java Lombok

[英]Integrate Java Lombok in Bitbucket Pipeline

我目前正在為 CI/CD 創建一個 Bitbucket 管道,我的 Spring Boot 應用程序到 AWS ECS。 我不知道如何整合 lombok。 沒有我得到很多編譯錯誤,因為注釋沒有正確翻譯。

# This is a sample build configuration for Java (Maven).
# Check our guides at https://confluence.atlassian.com/x/zd-5Mw for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: maven:3.5.2-jdk-8

pipelines:
branches:
master:
- step:
    name: Installing
    caches:
      - maven
    script: # Modify the commands below to build your repository.
      - mvn -B verify # -B batch mode makes Maven less verbose
- step:
    name: Build Docker Image
    services:
      - docker
    image: atlassian/default-image:2
    script:
        - echo $(aws ecr get-login --no-include-email --region eu-central-1) > login.sh
        - sh login.sh
        - docker build -f Dockerfile -t $ECR_STAGING_REPO_NAME .
        - docker tag $ECR_STAGING_REPO_NAME:latest $ECR_STAGING_REPO_URI:latest
        - docker push $ECR_STAGING_REPO_URI:latest
- step:
    name: Deploy to Production
    services:
      - docker
    deployment: production
    script:
      - pipe: atlassian/aws-ecs-deploy:1.0.6
        variables:
          AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
          AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
          AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
          CLUSTER_NAME: $ECS_PRODUCTION_CLUSTER_NAME
          SERVICE_NAME: $ECS_PRODUCTION_SERVICE_NAME
          TASK_DEFINITION: 'production_task_definition.json'

示例錯誤:

[ERROR] /<path>:[74,74] cannot find symbol
  symbol:   method getDeviceId()
  location: variable gameCredentials of type ...

目前,我正在為CI / CD創建一個Bitbucket管道,將我的Spring Boot應用程序連接到AWS ECS。 我不知道如何集成龍目島。 沒有我,我得到了很多編譯錯誤,因為注釋沒有正確翻譯。

# This is a sample build configuration for Java (Maven).
# Check our guides at https://confluence.atlassian.com/x/zd-5Mw for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: maven:3.5.2-jdk-8

pipelines:
branches:
master:
- step:
    name: Installing
    caches:
      - maven
    script: # Modify the commands below to build your repository.
      - mvn -B verify # -B batch mode makes Maven less verbose
- step:
    name: Build Docker Image
    services:
      - docker
    image: atlassian/default-image:2
    script:
        - echo $(aws ecr get-login --no-include-email --region eu-central-1) > login.sh
        - sh login.sh
        - docker build -f Dockerfile -t $ECR_STAGING_REPO_NAME .
        - docker tag $ECR_STAGING_REPO_NAME:latest $ECR_STAGING_REPO_URI:latest
        - docker push $ECR_STAGING_REPO_URI:latest
- step:
    name: Deploy to Production
    services:
      - docker
    deployment: production
    script:
      - pipe: atlassian/aws-ecs-deploy:1.0.6
        variables:
          AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
          AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
          AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
          CLUSTER_NAME: $ECS_PRODUCTION_CLUSTER_NAME
          SERVICE_NAME: $ECS_PRODUCTION_SERVICE_NAME
          TASK_DEFINITION: 'production_task_definition.json'

樣本錯誤:

[ERROR] /<path>:[74,74] cannot find symbol
  symbol:   method getDeviceId()
  location: variable gameCredentials of type ...

在 pom.xml 文件中,以如下方式為 lombok 添加以下依賴項:

<dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <scope>provided</scope>
</dependency>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <excludes>
                    <exclude>
                        <groupId>org.projectlombok</groupId>
                        <artifactId>lombok</artifactId>
                    </exclude>
                </excludes>
            </configuration>
        </plugin>
    </plugins>
</build>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM