There is a class in a maven dependency that is incompatible with Java 8.
How do you properly fix that problem?
Right now I\'m doing the following:
Similar to Steven S.'s answer, but using the maven-dependency-plugin. Based on this blog post.
I changed the name of the patched library (not the version), but it depends on your needs what works better for you.
The dependency on the original library should be marked as
. Otherwise, the projects that depend on your patched library will also depend on the original library, which means that both the patched and the original version will be on the classpath, which can lead to all kinds of problems.
If your project is a child project, you can still use a completely different groupId and version than your parent pom. Doesn't matter.
You can exclude the classes you patch from unpacking, but it's probably not necessary, because Maven will first unpack the original library and then compile your new version, which means that the original classes are overwritten. Nice!
4.0.0
my.company
my.company
1.2.3
../pom.xml
com.foo
foo-bar-patched
4.5.6
maven-dependency-plugin
unpack
com.foo
foo-bar
${project.build.directory}/classes
com.foo
foo-bar
4.5.6
true