When I run the above project, I get NoClassDefFoundError
Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/log4j/Logger
I added the log4j classes to the bindgen configuration , but I still get the NoClassDefFoundError. If I remove the exclude in the configuration within init.gradle , then it works fine. But my final war will be having
the commons-logging and log4j which I want to avoid.
Does the exclude configuration in init.gradle force on configuration that we define within a project ( like bind , bindGen ) in the above example.
If yes , how do we specify the classpath only for bindGen , still retaining the exclude configuration in init.gradle ?
is applied to EVERY configuration. Gradle does not differ between configurations that are introduced by plugins (e.g. compile, runtime, testruntime…) or your own added configurations. So you have to change your init.gradle file to get your createBinding service to work as expected: