public static void main(String[] args) throws IOException, URISyntaxException {
    // 'Greeting' comes from the dependency artfiact.
    String greeting = Greeting.getGreeting();

    // Gets the contents of the resource file 'world'.
    ClassLoader classLoader = HelloWorld.class.getClassLoader();
    Path worldFile = Paths.get(classLoader.getResource("world").toURI());
    String world = new String(Files.readAllBytes(worldFile), StandardCharsets.UTF_8);

    System.out.println(greeting + ", " + world + ". " + (args.length > 0 ? args[0] : ""));
  }
Example class that uses a dependency and a resource file.
jib-maven-plugin/src/test/resources/maven/projects/default-target/src/main/java/com/test/HelloWorld.java