Relocation deletes resources from included (project?) dependencies. #61

Closed
Minecrell opened this Issue Jun 28, 2014 · 4 comments

Comments

Projects
None yet
2 participants
@Minecrell
Contributor

Minecrell commented Jun 28, 2014

I want to include a subproject dependency (Core) in the shadow JAR of another subproject (App). The Core project just contains some classes used in the App project and a plain text file named TEST with some example text in it. The resulting Core JAR includes the original compiled classes and the TEST file correctly.
Now if I include the Core dependency in the App project without any relocation it copies the classes and resources correctly to the resulting shadow JAR, but if I relocate the core package to a package within the app package then the resources of the Core project are not included in the resulting JAR file (the TEST file is missing).

I don't know exactly how to explain the complete project structure so it's probably better if you take a look at the test project yourself: https://github.com/Minecrell/GradleTest

So basicly when I use relocation then the resources of the project dependency are not copied to the resulting JAR.

@johnrengelman johnrengelman added the bug label Jun 30, 2014

@johnrengelman johnrengelman added this to the 1.0.2 milestone Jul 1, 2014

@johnrengelman

This comment has been minimized.

Show comment
Hide comment
@johnrengelman

johnrengelman Jul 2, 2014

Owner

using your example project, when I remove the relocation commands, I still do not get the TEST resource into the shadow Jar. Not sure what filtering is happening there.

Owner

johnrengelman commented Jul 2, 2014

using your example project, when I remove the relocation commands, I still do not get the TEST resource into the shadow Jar. Not sure what filtering is happening there.

@Minecrell

This comment has been minimized.

Show comment
Hide comment
@Minecrell

Minecrell Jul 2, 2014

Contributor

Which lines have you removed? When I remove this shadowJar configuration block, then the TEST resource is included for me in the App shadowJar (App/build/libs/App-1.0-all.jar) on both Windows and my Linux server, but with the relocation the file does not appear.

Contributor

Minecrell commented Jul 2, 2014

Which lines have you removed? When I remove this shadowJar configuration block, then the TEST resource is included for me in the App shadowJar (App/build/libs/App-1.0-all.jar) on both Windows and my Linux server, but with the relocation the file does not appear.

@johnrengelman johnrengelman modified the milestones: 1.0.3, 1.0.2 - Bug fixes Jul 7, 2014

@Minecrell

This comment has been minimized.

Show comment
Hide comment
@Minecrell

Minecrell Jul 7, 2014

Contributor

Have you found out what is causing this issue? I think the cause is this method. If relocation is configured and no transformators exist for an entry you don't copy it directly and give it to the remapClass method instead. That will relocate the file if it is a class file, but there are also given normal resource files to this method that you just ignore them at the moment instead of copying them to the shadow JAR.

So I think adding a simple else statement there that will just copy the entries instead should fix the problem. What do you think?

Contributor

Minecrell commented Jul 7, 2014

Have you found out what is causing this issue? I think the cause is this method. If relocation is configured and no transformators exist for an entry you don't copy it directly and give it to the remapClass method instead. That will relocate the file if it is a class file, but there are also given normal resource files to this method that you just ignore them at the moment instead of copying them to the shadow JAR.

So I think adding a simple else statement there that will just copy the entries instead should fix the problem. What do you think?

@Minecrell

This comment has been minimized.

Show comment
Hide comment
@Minecrell

Minecrell Jul 17, 2014

Contributor

Thank you so much for all your effort and time to solve such specific problems! Will test it as soon you release the new version!
Edit: Just saw that you also publish snapshot versions now. I will test them later! :)

Contributor

Minecrell commented Jul 17, 2014

Thank you so much for all your effort and time to solve such specific problems! Will test it as soon you release the new version!
Edit: Just saw that you also publish snapshot versions now. I will test them later! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment