dev@glassfish.java.net

About building customized hk2 snapshot based hk2 1.x branch

From: Tang Yong <tangyong_at_cn.fujitsu.com>
Date: Thu, 11 Oct 2012 12:54:00 +0900

Hi Romain,

 Now, I have resolved the problem successfully using regular building way.

 Because my previous thread is too long, I opened a new thread.

 Firstly, I provided my building steps in details.

●My Building Env
- maven 3.0.4
- jdk 1.6.0_34
- windows xp

[Building Steps]
1 checkout hk2 1.1.15 source from [1]
[1]: https://svn.java.net/svn/hk2~svn/tags/hk2-parent-1.1.15

2 confirm maven setting.xml accoring to [2]
- setting proxy (because I connect internet by means of proxy server)
- adding the following contents into setting.xml
<mirrors>
    <mirror>
      <id>maven-central</id>
      <url>http://repo1.maven.org/maven2/</url>
      <mirrorOf>*,!eclipselink.repository</mirrorOf>
    </mirror>
</mirrors>
[2]:
https://wikis.oracle.com/display/GlassFish/FullBuildInstructions#FullBuildInstructions-Settings.xml

3 open cmd shell and prepare building
1) cd D:\hk21.1.15
2) set MAVEN_OPTS=-Xmx512m

4 update version into your customized hk2 snapshot(eg.
1.1.15-ty-10000-SNAPSHOT)

executing "mvn release:update-versions"

Note1: before executing "mvn release:update-versions", you must first
modify the version of hk2-parent pom into 1.1.15-ty-10000-SNAPSHOT,
otherwise, you will get the following error:

[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-release-plugin:2.1:update-versions
(default-cli) on project hk2-parent: You don't have a SNAPSHOT project
in the reactor projects list. -> [Help 1]

Note2: while executing "mvn release:update-versions", You will be
prompted for the version number for each module of the project. On [3],
although referring that using "mvn release:update-versions
-DautoVersionSubmodules=true" can make you only be prompted for the
desired version number once, the way has no effect on hk2 1.1.15. For
example, after you execute "mvn release:update-versions
-DautoVersionSubmodules=true", you can find that on pom of
class-model,there are following contents:

<parent>
   <groupId>org.glassfish.hk2</groupId>
   <artifactId>hk2-parent</artifactId>
   <version>1.1.15-ty-10000-SNAPSHOT</version>
   <relativePath>../pom.xml</relativePath>
</parent>
<groupId>org.glassfish.hk2</groupId>
<artifactId>class-model</artifactId>
<version>1.1.15</version>
<name>Class Model for Hk2</name>

Apparently, the version of class-model is not still updated.

[3]:
http://maven.apache.org/plugins/maven-release-plugin/examples/update-versions.html

5 modify hk2-parent pom and restore osgiversion-maven-plugin's version
into 1.1.15

About the point, Romain has said why and pl.see my previous thread.

6 [Important!]

(1) At the point, if you start to execute "mvn -Prelease-phase1
install", you will get the following error:

[INFO]
[INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) @ class-model ---
[INFO] Building jar:
D:\hk21.1.15\class-model\target\class-model-1.1.15-ty-10000-SNAPSHOT.jar
[INFO]
[INFO] >>> maven-javadoc-plugin:2.3:jar (attach-javadocs) @ class-model >>>
[INFO]
[INFO] -----------------------------------------------------------------
[INFO] Forking Modules Subsystem 1.1.15-ty-10000-SNAPSHOT
[INFO] -----------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @
hk2-parent ---
[INFO]
[INFO] -----------------------------------------------------------------
[INFO] Forking Class Model for Hk2 1.1.15-ty-10000-SNAPSHOT
[INFO] -----------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @
class-model ---
[INFO]
[INFO] -----------------------------------------------------------------
[INFO] Forking org.objectweb.asm.all version 3.3 repackaged as a module
1.1.15-ty-10000-SNAPSHOT
[INFO] -----------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @
asm-all-repackaged ---
[INFO]
[INFO] -----------------------------------------------------------------
[INFO] Forking Inversion of Control / Autodependency mechanism
1.1.15-ty-10000-SNAPSHOT
[INFO] -----------------------------------------------------------------
Downloading:
http://repo1.maven.org/maven2/org/glassfish/hk2/external/asm-all-repackaged/1.1.15-ty-10000-SNAPSHOT/maven-metadata.xml
Downloading:
http://repo1.maven.org/maven2/org/glassfish/hk2/external/asm-all-repackaged/1.1.15-ty-10000-SNAPSHOT/asm-all-repackaged-1.1.15-ty-10000-SNAPSHOT.jar
[INFO]
------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Modules Subsystem ................................. SUCCESS [6.266s]
[INFO] Class Model for Hk2 ............................... FAILURE [59.812s]
[INFO] org.objectweb.asm.all version 3.3 repackaged as a module SKIPPED
[INFO] Inversion of Control / Autodependency mechanism ... SKIPPED
[INFO] Inhabitants' index generator ...................... SKIPPED
[INFO] Validation API (JSR 303) version 1.0, Hibernate Validator version
4.3.0.Final and its dependencies repackaged as OSGi bundle SKIPPED
[INFO] HK2 configuration module .......................... SKIPPED
[INFO] HK2 core module ................................... SKIPPED
[INFO] HK2 configuration reader generator module ......... SKIPPED
[INFO] OSGi repackaging of HK2 dependencies .............. SKIPPED
[INFO] Module system maven support ....................... SKIPPED
[INFO] HK2 OSGi Adapter .................................. SKIPPED
[INFO] Static Analyser for verifying module dependency ... SKIPPED
[INFO] Maven Plugin for hk2 .............................. SKIPPED
[INFO] hk2-dependency-visualizer ......................... SKIPPED
[INFO] Maven Plugin for computing OSGi versions from Maven versions SKIPPED
[INFO] consolidated bundle Maven plugin .................. SKIPPED
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 1:06.422s
[INFO] Finished at: Thu Oct 11 12:14:26 JST 2012
[INFO] Final Memory: 13M/33M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal on project auto-depends: Could not
resolve dependencies for project
org.glassfish.hk2:auto-depends:jar:1.1.15-ty-10000-SNAPSHOT: Could not
find artifact
org.glassfish.hk2.external:asm-all-repackaged:jar:1.1.15-ty-10000-SNAPSHOT
in maven-central (http://repo1.maven.org/maven2/) -> [Help 1]
[ERROR]

【Reason】
The problem results from maven-enforcer-plugin which checks Maven
version, although hk2-parent pom does not define the maven plugin, on
parent pom(jvnet-parent-1.pom), maven-enforcer-plugin is defined.
Because defining the plugin, maven-enforcer-plugin will executes rules
for each module in a multi-modules build, So, although Class Model does
not depend on auto-depends, the error liking "could not find
asm-all-repackaged:jar:1.1.15-ty-10000-SNAPSHOT..." still happened.

(2) Fixing Way - Modify hk2-parent pom in order to disable
maven-enforcer-plugin liking the following :
...
<build>
    <sourceDirectory>src/java</sourceDirectory>
    <testSourceDirectory>test/java</testSourceDirectory>
    <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-enforcer-plugin</artifactId>
         <inherited>false</inherited>
       </plugin>
      ...

Then, executing "mvn -Prelease-phase1 install" again. This time: OK!
...
[INFO] Reactor Summary:
[INFO]
[INFO] Modules Subsystem ................................. SUCCESS [0.625s]
[INFO] Class Model for Hk2 ............................... SUCCESS [52.968s]
[INFO] org.objectweb.asm.all version 3.3 repackaged as a module SUCCESS
[23.047s]
[INFO] Inversion of Control / Autodependency mechanism ... SUCCESS [56.438s]
[INFO] Inhabitants' index generator ...................... SUCCESS [15.015s]
[INFO] Validation API (JSR 303) version 1.0, Hibernate Validator version
4.3.0.Final and its dependencies repackaged as OSGi bundle SUCCESS
[26.422s]
[INFO] HK2 configuration module .......................... SUCCESS [27.875s]
[INFO] HK2 core module ................................... SUCCESS [23.891s]
[INFO] HK2 configuration reader generator module ......... SUCCESS [6.344s]
[INFO] OSGi repackaging of HK2 dependencies .............. SUCCESS [0.125s]
[INFO] Module system maven support ....................... SUCCESS [8.062s]
[INFO] HK2 OSGi Adapter .................................. SUCCESS [11.297s]
[INFO] Static Analyser for verifying module dependency ... SUCCESS [8.875s]
[INFO] Maven Plugin for hk2 .............................. SUCCESS [23.250s]
[INFO] hk2-dependency-visualizer ......................... SUCCESS [3.984s]
[INFO] Maven Plugin for computing OSGi versions from Maven versions
SUCCESS [5.766s]
[INFO] consolidated bundle Maven plugin .................. SUCCESS [3.422s]
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO]
------------------------------------------------------------------------

7 executing "mvn clean install"

OK!

Thanks!
--Tang