dev@glassfish.java.net

Re: [_at_GFv3] Why are hk2 jars installed with .hk2-jar extension?

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 25 Mar 2008 10:09:48 -0700

Sahoo wrote:
> I see files with .hk2-jar extension instead of .jar in my local maven
> repository for all my glassfish modules with packaging type hk2-jar.
> What is this new file type? When was it introduced? Why is it needed?

When we introduce a "custom life cycle" (as in Maven jargon --- AKA
<packaging>), by default Maven tries to use this name as the official
file extension.

There's another extension point in Maven called ArtifactHandler, which
lets us override this behavior and let us choose the extension of our
choice (among other things.) So in HK2 maven plugin, we do this to set
the extension to ".jar"

All these are loaded into GFv3 build by the following line in v3/pom.xml:

> <plugin>
> <groupId>com.sun.enterprise</groupId>
> <artifactId>hk2-maven-plugin</artifactId>
> <version>${hk2.version}</version>
> <extensions>true</extensions>
> </plugin>


What you are seeing suggests that for whatever reason the
ArtifactHandler is not kicking in. Interestingly, other parts of this
plugin must be working, or else Maven won't be able to recognize
<packaging>hk2-jar</packaging>.

I quickly rebuilt the v3 locally, both as a whole and partially just the
admin module, but I didn't experience the problem you saw.

Also, when I see the Maven repository like [1], I see that Hudson is
also pushing *.jar (you see left-over *.hk2-jar before I fixed this
problem in Hudson --- these files need to be removed.)

That said, it is possible that we have some kind of race condition
between the registration of ArtifactHandler vs the use of it.

Which version of Maven do you use? Does anyone else reproduce the problem?


[1]
http://maven.dyndns.org/glassfish/org/glassfish/admin/admin-cli/10.0-SNAPSHOT/
-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com