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 moves classes to new package, but keeps old package in the JAR. #53

Closed
stephan-gh opened this issue Jun 26, 2014 · 6 comments

Comments

@stephan-gh
Copy link
Contributor

When I relocate the guava package in my test project to another package, it moves the classes correctly but if I look into the JAR the folder of the original package still exists.

relocate 'com.google.common', 'net.minecrell.gradletest.com.google.common'

Guava has been moved to the correct package but there is still the com folder with all of the sub directories as well.

@johnrengelman
Copy link
Collaborator

That shouldn't have any negative effect, it's just entry structure within the archive. I'm not sure I can do anything about it without having to do a second pass through the jar, which doesn't seem like a good practice.

The reason is that the relocation is done on an entry by entry basis, but the parent directory structure needs to be created first and there is no way to know ahead of time if all the entries within the directory are going to be relocated.

@stephan-gh
Copy link
Contributor Author

Hmm, yes it should not really matter. But actually I would prefer to have a clean JAR without unneeded entries so if you find a way to remove them maybe you can add an option for it because I don't mind waiting some seconds longer.

@johnrengelman
Copy link
Collaborator

I'm not going to add an option to do that. As I fix the relocation bug, I'll see if I can stop this (I think there is).

@stephan-gh
Copy link
Contributor Author

Okay, thank you. :)

@johnrengelman
Copy link
Collaborator

So, after looking at this more, there is a part that I had to fix. Not only was it leaving the source directories around, I wasn't creating the directories for the target location. No big deal, unless you try to do some type of package scanning. So that should be fixed now.

@stephan-gh
Copy link
Contributor Author

Just tested the new version 1.0.0 and it doesn't generate the old folders of the dependencies anymore. However, for some reason in the JAR file is an empty folder with the name of the file. (In my case GradleTest-1.0-all). This is kinda strange but I don't really mind, but maybe it is just a small mistake that is easily fixable?
Relocations of packages within the source files still generate their old folders in the JAR but as of I don't use that, it's not important to fix (for me).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants