-
Notifications
You must be signed in to change notification settings - Fork 395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add meta includes from main jar artifact #602
Conversation
if ( this.apkMetaInf != null ) | ||
{ | ||
File outputJar = new File( outputApk.substring( 0, outputApk.length() - 3 ) + "jar" ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe using a property ${finalName}.jar
for this value is betting than the substring
thing.
The jar is just a side effect. Everything should go into the apk or aar directly. This seems wrong unless I am misunderstanding something. Wdyt @simpligility/android-maven-plugins-core-committers |
I'm struggling to understand why there would be any jars added to the APK. AT that point all Java classes should be dexed. Most definitely the project jar should not be included. |
As far as I understand this is about the META-INF from the jar. Even so though I think this is wrong. To a wide degree the fact that there is a jar being produced by the Android Maven Plugin is a legacy thing since it needed to be there to get instrumentation tests and other things to work. But I certainly dont think we should make this a required thing for e.g. the META-INF usage. I am more inclinded to work towards NOT creating a jar anymore. What is the use case for this @kedzie ? |
so the android apk packaging tool strips contents of meta inf folder. the
|
now it loops through the dependencies and adds the meta inf resources to
|
this is about required resources, like meta-inf/services files.. or
|
In summary, if you don't like depending on the main artifact jar being there, we could potentially change the code to copy the META-INF resources from the This change is required for the Drools Android work I'm doing. There are a lot of important resources in the META-INF folder in drools projects. I imagine other projects as well... |
It's not about not liking the main artifact jar being there. Copying the main jar to your APK should have zero effect. The Android runtime won't open your jar and read any contained resources such as META-INF/services. Let me restate your problem so I understand.
I am pretty sure that standard java resources (src/main/resources) are copied to the APK. If that's the case then I'm not sure why this isn't working for you. |
Your understanding of my problem is correct. But you aren't understanding the current behavior of the plugin. files under The android packaging tool strips the contents of the META-INF folder. That is why this android-maven-plugin has the feature to add resources back into the APK after it is packaged. That functionality is controlled using the apk->metaInf include/exclude plugin configuration properties.
The problem with that functionality is that it only copies back in META-INF resources from the dependencies, NOT from the artifact itself. So if you put some resources into |
And to clarify I am not packaging the jar file into the apk. It is copying the META-INF resources from the jar file and adding them to the APK. This is done to replace the META-INF resources which were stripped by the apk packaging tool. |
Take a look at any APK created by the android-maven-plugin, notice it doesn't have maven/groupId/artifactId/pom.properties or maven/groupId/artifactId/pom.xml files. Both of which I need. |
Could you please chime in on this @mosabua? I'm confident this is a valid change but seems I'm failing to get the point across. I could provide an example project for instance.. |
Add meta includes from main jar artifact
Thanks @kedzie I understand what you were after now. |
The META-INF includes functionality added back in stripped resources from the META-INF folder but only from 3rd party jar dependencies. Not resources from the actual application. So I added the output jar to the list of jars that are processed by the addMetaInf function to include application resources as well.