[英]Configuring gitlab-ci.yml for simple java project
I have a simple java project with HelloWorld class , I want to add the GitLab CI/CD for this project by using the .gitlab-ci.yml and runnable configuration files , I am trying to find the reference but am unable to find for simple java project , any help in configuring the above project is appreciated.我有一个带有 HelloWorld 类的简单 java 项目,我想通过使用 .gitlab-ci.yml 和可运行配置文件为该项目添加 GitLab CI/CD,我试图找到参考,但无法找到简单的java 项目,对配置上述项目的任何帮助表示赞赏。 Thanks Rama谢谢拉玛
I used this as a simple setup for my .gitlab-ci.yml
我用它作为我的.gitlab-ci.yml
的简单设置
build:
stage: build
image: openjdk:8-jdk
script: javac src/javaTest/JavaTest.java
artifacts:
untracked: true
https://gitlab.com/peterfromearth/java-test/blob/master/.gitlab-ci.yml https://gitlab.com/peterfromearth/java-test/blob/master/.gitlab-ci.yml
That will build & test your application using gradle :这将使用 gradle 构建和测试您的应用程序:
image: gradle:alpine
stages:
- build
- test
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
build:
stage: build
script:
gradle --build-cache assemble
artifacts:
paths:
- build/libs/*.jar
expire_in: 1 week
test:
stage: test
script:
gradle check
after_script:
- echo "End CI"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.