Coder Social home page Coder Social logo

gradle-template's Introduction

Introduction

This project is meant as starting point for Trifork projects that use Gradle as build-system. It is a good idea to become familiar with Gradle, and the Gradle Userguide is a very good reference.

To get started make a git repository and add this repository as a remote:

git remote add template git://github.com/trifork/gradle-template.git

That way you can also easily get any future additions:

git pull template master

The template contains two example sub-projects, one Java and one Scala.

Suggestions and patches (or pull requests) are very welcome. If you encounter any bugs please make an issue on Github.

Build Customization

Take a look in 'gradle.properties', 'build.gradle', 'settings.gradle' and in the config-directory to customize the build to fit your project.

There are very few things that actually need to be changed in the build configuration – at least to start out with. But there are though a couple of properties you need to change in 'gradle.properties'.

First off, you will have to change the name of the projectName and nextReleaseVersion properties. These properties are defined in gradle.properties file. The properties are described in greater detail in the file itself.

If you do not want to use Jira or use some other SCM than Git you will also have to change some settings in the config/deployment.groovy file.

Coding standards and formatting is checked using Checkstyle. You can edit them to fit your project in config/checkstyle/checkstyle.xml.

Dependency Management

It is a good idea to keep a list of dependencies you use in several sub-projects in the config/libraries.groovy file. That way you can keep versions consistent. There is of course nothing that is stopping your from declaring dependencies on an ad-hoc basis in your sub-projects. But this can quickly get out of hand for larger projects.

Plugins

Gradle has a good plugin system. By default Gradle comes with a lot of handy plugins, but they are quite general and need some customization. Therefore there is a set plugin specificly made for Trifork projects.

By default only the deployment plugin is added. It helps you use the Trifork nexus server correctly and use a consistent scheme for deployment of artifacts, both class and source files.

All the plugins are described in the Plugin Project's README. You can find it here.

Releases & Snapshots

When you apply the deployment-plugin you get a few extra tasks to help you share your artifacts.

It is important to have a well-defined and consistent way of sharing jar files and other artifacts. Maven repos are the de-facto standard for artifact sharing and by using it you get a high degree of interoperability between build systems.

When making a release it is important to make sure that you don't depend on any snapshot artifacts. Since snapshots change over time, future snapshot versions will potentially break your release (which is bad).

TODO: In future this check might be automated.

Git Tips

It is a good idea to check your code before you push anything to other central repositories. While you don't necessarily want to run tests and check code for every commit you do locally.

You can setup a git command alias to check your code before you push anything.

git config alias.publish '! gradle check && git push "$@"'

This will allow you to e.g. write:

git publish origin master

as an alternative to git push. Please note that since you will be running tests and other code checks this will usually take considerably longer than a normal push.

Requirements

This build setup is made for Gradle 1.0-milestone-6.

If you want to run the Scala subproject you will need to have install a version of Scala.

gradle-template's People

Contributors

anagrius avatar

Stargazers

 avatar

Watchers

Søren Eskildsen avatar James Cloos avatar  avatar

Forkers

isabella232

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.