uklance/gradle-java-monkey-patch

Support for aar files and Android

Closed this issue · 1 comments

Hi,

good job with this plugin, it's exactly what I need. I am having trouble using it in my Android project though, as I don't know much about gradle and Java. Some help would be much appreciated.

plugins {
    id "com.lazan.java-monkey-patch" version "1.0"
}

monkeyPatch {
    target = 'host.foo:bar:1.0.0@aar'
}

A problem occurred configuring project ':app'.
The 'java' plugin has been applied, but it is not compatible with the Android plugins.

I am getting this error after I added the plugin to build.gradle, when building my app on Android Studio. Is the plugin not compatible with Android? Any idea what might be happening? Also, is it possible to target aar dependencies?

Thanks!

Hi, I'm not an android developer so might need a bit of hand holding to understand the android plugin.

My plugin assumes you have a jar and want to override class files by compiling java files and/or plain resources.

It applies the java plugin here and then tweaks the "jar" task added by the "java" plugin.

Perhaps a similar plugin could be developed to apply the "android" plugin and tweak the "aar" task rather than trying to fudge this one

As you can see I called the plugin "java-monkey-patch" so there's possibility to create additional plugins for "android-monkey-patch" or "groovy-monkey-patch" etc