首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无人机管道: Maven存储库无法解决的无人机缓存安装路径

无人机管道: Maven存储库无法解决的无人机缓存安装路径
EN

Stack Overflow用户
提问于 2022-10-18 09:23:28
回答 1查看 66关注 0票数 0

我是新的无人机管道,并有兴趣使用它在我目前的项目为CICD。我的项目技术堆栈如下:

  1. Java
  2. Spring Boot
  3. Maven

我已经创建了一个示例无人机管道,但无法缓存下载并存储在.m2文件夹中的maven依赖项。总是说挂载路径不可用或找不到。请查找相同的屏幕截图:

无人机挂载路径问题

不确定这里要提供的路。有人能帮助我理解挂载路径吗?我们需要提供这个路径来缓存.m2路径中的所有依赖项。添加以下管道信息:

代码语言:javascript
复制
kind: pipeline
type: docker
name: config-server

steps:

name: restore-cache
image: meltwater/drone-cache
pull: if-not-exists
settings:
backend: "filesystem"
restore: true
cache_key: "volume"
archive_format: "gzip"
mount:
- ./target
- /root/.m2/repository
volumes:
name: cache
path: /tmp/cache

name: build
image: maven:3.8.3-openjdk-17
pull: if-not-exists
environment:
M2_HOME: /usr/share/maven
MAVEN_CONFIG: /root/.m2
commands: 
mvn clean install -DskipTests=true -B -V
volumes:
name: cache
path: /tmp/cache

name: rebuild-cache
image: meltwater/drone-cache
pull: if-not-exists
settings:
backend: "filesystem"
rebuild: true
cache_key: "volume"
archive_format: "gzip"
mount:
- ./target
- /root/.m2/repository
volumes:
name: cache
path: /tmp/cache

trigger:
branch:
main
event:
push

volumes:
name: cache
host:
path: /var/lib/cache

提前谢谢..。

EN

回答 1

Stack Overflow用户

发布于 2022-10-19 10:19:22

解决了这个问题。请找到下面的解决方案和正在工作的无人机管道。

代码语言:javascript
复制
kind: pipeline
type: docker
name: data-importer

steps:

- name: restore-cache
  image: meltwater/drone-cache
  pull: if-not-exists
  settings:
    backend: "filesystem"
    restore: true
    ttl: 1
    cache_key: "volume"
    archive_format: "gzip"
    mount:
      - ./.m2/repository
  volumes:
  - name: cache
    path: /tmp/cache
    
- name: maven-build
  image: maven:3.8.6-amazoncorretto-11
  pull: if-not-exists
  commands:
    - mvn clean install -DskipTests=true -Dmaven.repo.local=.m2/repository -B -V
  volumes:
  - name: cache
    path: /tmp/cache
   
- name: rebuild-cache
  image: meltwater/drone-cache
  pull: if-not-exists
  settings:
    backend: "filesystem"
    rebuild: true
    cache_key: "volume"
    archive_format: "gzip"
    ttl: 1
    mount:
      - ./.m2/repository
  volumes:
  - name: cache
    path: /tmp/cache
    
trigger:
  branch:
  - main
  - feature/*
  event:
  - push
  
volumes:
  - name: cache
    host:
      path: /var/lib/cache

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74108600

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档