Code Monkey home page Code Monkey logo

stage2-module1-build-tools-gradle's Introduction

Build Tools

Materials

Practice

In this task you are going to create the same application as in Maven module, but with Gradle build tool.

Task 1

  1. After Gradle installation make sure that you have 'gradle' package with wrapper inside;
  2. Open root settings.gradle file and add two modules: utils, demo.

Task 2

Custom jar utils-1.3.5.jar will be created with the following instructions:

  • The jar should contain class StringUtils with method boolean isPositiveNumber(String str).
  • Apache Commons Lang 3.10 library is used to implement this method.
  1. Open build.gradle in 'utils' and fill it with proper group, version and delete comments with proper implementation
plugins {
    // id for library
    // id for maven to publish jar to local repository
}

java {
// provide sourceCompatibility
}

repositories {
// provide repository, where required dependencies are located
}

publishing {
    publications {
        maven(MavenPublication) {
// provide groupId
// provide artifactId
// provide version

            from components.java
        }
    }
}

//add Apache Apache Commons Lang 3.10 (or higher) dependency

jar {
    manifest {
        //provide manifest with such attributes as 'Implementation-Title', 'Implementation-Version'
    }
}
  1. Implement method in StringUtils.class:
public class StringUtils {
    public static boolean isPositiveNumber(String str) {
        //here magic will happen
    }
}

Task 3

Now we will use the created util class:

  1. Open build.gradle in 'demo' and fill in group, version, repositories and required dependency;

  2. Provide required implementation:

public class Utils {
    public static boolean isAllPositiveNumbers(List<String> args) {
       //magic happens here
    }
}

Task 4

Make sure that application passes all test suits.

stage2-module1-build-tools-gradle's People

Contributors

lizaveta-epm avatar symbatdeveloper avatar

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.