From the course: Gradle for Java-Based Applications and Libraries

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: Consuming an external dependency

Challenge: Consuming an external dependency

From the course: Gradle for Java-Based Applications and Libraries

Start my 1-month free trial

Challenge: Consuming an external dependency

(upbeat music) - [Instructor] In this chapter, we covered the basics of dependency management for Java-based projects. I want you to become more familiar with the mechanics and the workflow. This challenge starts out with an existing Java program. The program defines a class named string reverser that can reverse the characters of any given string. The main class instantiates the string reverser class and uses it to feed in two different strings to see the functionality in action. Right now, the reverse method has been hand-coded and contains a couple of lines of code. Run the program once to see the results. We want to replace the functionality by a library called Apache Commons that provides a pre-built method for this purpose. Start by locating the dependency on Maven Central to verify that it does exist. Then declare the repository and the dependency in your project. In the class string reverser, import the class…

Contents