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
From the course: Gradle for Java-Based Applications and Libraries
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Mechanics of dependency management1m 59s
-
(Locked)
Declaring a dependency on an external library2m 38s
-
(Locked)
Rendering the dependency tree2m 36s
-
(Locked)
Declaring a project dependency3m 5s
-
(Locked)
Using the Maven Publish plugin to publish a library3m 7s
-
(Locked)
Challenge: Consuming an external dependency1m 44s
-
(Locked)
Solution: Consuming an external dependency3m 29s
-
(Locked)
-
-