maven-compiler-plugin fails to compile a file that Eclipse has no problem with

Eclipse compiles the following code without any problem, whereas when mvn tries to compile this code, a compilation failure results:

try {
    // Distribution.rep().get(id) returns a java.util.Optional
    Distribution updated = Distribution.rep().transact(() -> {
        Distribution distro = Distribution.rep().get(id).orElseThrow(() -> {
            throw new NotFoundException("Couldn't find Distribution with ID '%s'.", id);
        });
        // Other stuff...
    });
    rs.setData(updated);
} catch (ExecutionException e) {
    // Handle the error
} catch (Exception e) {
    // Handle the exception
}

The error thrown by maven-compiler-plugin:3.1 is:

unreported exception java.lang.Throwable; must be caught or declared to be thrown

NotFoundException extends RuntimeException. The transact method wraps all runtime (?) exceptions in an ExecutionException before throwing them. Either way, this NotFoundException (when thrown) should get caught by the catch clause for ExecutionException, so what's the problem?

From what I can understand the maven-compiler-plugin seems to think that the NotFoundException is a Throwable. NotFoundException is defined in my code (project), so maven-compiler-pluginshould know about it...

Source and target for the compiler plugin are defined as 1.8. Have Java version 1.8.0_181. Tried with maven-compiler-plugin version 3.8.0, got the same result.