On Mon, Aug 15, 2016 at 10:29 AM, Michael Osipov <micha...@apache.org> wrote:
> JARs are ZIPs with a different name, no less but a bit more. java(1) > treats ZIP files as first-class citizens. We have taken away to option > previously. People, including me, have abused JARs as resource containers > (JS, images, css) to have them on the classpath with the entire, convoluted > lifecycle JAR has. > Yes, JARs are ZIPs with a different name, but not every ZIP is JAR. That was the point I was trying to get across. Just because a Java project employs ZIP files, it doesn't mean the ZIP is meant to be on the classpath. To be clear regarding my personal experience in using ZIPs, I am not abusing JARs as resource containers: neither as a .jar file extension nor "jar" Maven project type. I agree that's an abuse and have always avoided it. > Control of the classpath is the dependency list itself, isn't it? > There is opt-in/-out att all for any kind of dependency. > > Third, it's possible a "zip" non-classpath resource could conflict with a >> same named resource in the classpath. I haven't had to be concerned with >> this (yet), but I will be on the lookout if MNG-5567 doesn't change. >> > > I conflict in resources names can also happen with JARs and you have no > control of it at all as of today. > > How would you try to solve the problem? > I propose introducing a new scope. All the scopes dictate when a dependency makes it onto the classpath. In the case of a pure non-classpath resource container, it never needs be on the classpath, but it does need to remain available in the reactor. No current scope fits this need. If I may propose the new scope name, I would call it "asset". Furthermore, I would give "zip" types this new "asset" scope as the default. If anyone wants to add such a dependency to the classpath, they should specify the appropriate scope. The benefit here is that (1) people who are currently using "zip" (custom handlers?) wouldn't get their classpath upended by new behavior and (2) explicitly adding a "zip" to the classpath requires them to think about what scope they desire. Cheers, Paul