Skip to content
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

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

Closed
stephan-gh opened this issue Jun 28, 2014 · 4 comments
Closed
Labels
Milestone

Comments

@stephan-gh
Copy link
Contributor

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 this to the 1.0.2 milestone Jul 1, 2014
@johnrengelman
Copy link
Collaborator

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.

@stephan-gh
Copy link
Contributor Author

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
@stephan-gh
Copy link
Contributor Author

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?

@stephan-gh
Copy link
Contributor Author

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
Labels
Projects
None yet
Development

No branches or pull requests

2 participants