Gitlab-ci for java project

I trying to config gitlab-ci file for java project without Maven, Gradle, etc. This is my file:

image: java:latest

stages:
    - build

build:
    stage: build
    script: 
        - '"C:\Program Files\Java\jdk1.8.0_181\bin\javac" StockServer.java'
    artifacts:
        paths:
         - StockServer.*

But my runner install on remote computer, so it can not find StockServer.java (in example HelloWorld.java was in the same directory). How should I set path to file at runners directory? And will it be a compilation of all project (StockServer contains main())? Or just this class?

Upvotes: 3

Views: 680

Answers (1)

My answer will not be quite on the question posed, but I will share my solution - I added gradle to my project, and with it, such .gitlab-ci.yml:

image: java: 8-jdk

stages:
  - build

build:
  stage: build
  script:
    - ./gradlew assemble
  artifacts:
    paths:
      - main_project / build / libs / *. jar

I created jar file assembly on gitlab. It seems to me that this option is better, because I was told that assembling the project "by hand" is not comme il faut.

Upvotes: 1

Related Questions