Example of Travis CI yml file for java

半世苍凉 提交于 2019-11-30 08:45:39

Travis CI is NOT a build tool. It is a Continous Integration tool which usually executes the same build command you would do locally, but automatically after every push to GitHub.

It requires a build mechanism being active. Well, that is not totally true, but it requires you to specify a valid command in the script: section that can be executed on the Travis CI host trying to build your code. When the return code of the command is 0, the build is treated as SUCCESS. Otherwise, it is treated as FAILURE.

(This is all really simplified, best would be to read Travis CI documentation, and perhaps some documents about Continous Integration in general).

In short: Set up your project to use Maven or Gradle or your favourite build tool. You should be able to locally execute mvn clean verify (when using Maven). Then, set up your .travis.yml:

language: java
sudo: false
script: mvn clean verify

And commit & push it, together with the pom.xml (when using Maven). Now, Travis CI should work like a charm.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!