繁体   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