Who is Responsible for Integrating JSR-299 into Glassfish?

Oracle Employees: JJ Snyder, Sivakumar Thyagarajan, Kshitiz Saxena

Overview

GlassFish integrates the CDI reference implementation, Project Weld, for the CDI functionality. The latest introduction to Weld and technical documentation on CDI is here.

Most Recently Integrated Version of JSR-299 Implementation

The binary integration artifacts of JSR-299 for Glassfish V3 consists of two OSGi module jars:

  • weld-osgi-bundle.jar (Weld Implementation classes)
  • weld-integration.jar (Classes that implement and support the Weld SPI for GlassFish)

The most recently integrated version in GlassFish trunk and 3.1.2 is Weld 1.1.4.Final.

Note: If we fork weld to create a temporary GlassFish branch of Weld, we use the branch/tag naming pattern "1.1.0-X-glassfish" for the following reasons:

  • ensure that 1.1.0-01-glassfish < 1.1.0-Beta1.
  • Similarly if we want to create a branch from 1.1.0-Beta1 (for some reason in the future) just before Beta2 comes out, it could be called 1.1.0-Beta2-01-glassfish and this would satisfy
    1.1.0-Beta1 < 1.1.0-Beta2-01-glassfish < 1.1.0-Beta2

Integration Information

The Weld 1.1 maven artifacts are located in the JBoss nexus repository http://repository.jboss.org/nexus/content/groups/public/. The old Weld 1.0.x artifacts are avaialable at http://repo2.maven.org/maven2/org/jboss/weld/

The Weld build includes a pom.xml used to produce weld-osgi-bundle.jar and it has the following maven dependencies:

<dependencies>
      <dependency>
         <groupId>javax.enterprise</groupId>
         <artifactId>cdi-api</artifactId>
      </dependency>
      <dependency>
         <groupId>org.jboss.weld</groupId>
         <artifactId>weld-api</artifactId>
      </dependency>
      <dependency>
         <groupId>org.jboss.weld</groupId>
         <artifactId>weld-core</artifactId>
      </dependency>
      <dependency>
         <groupId>org.jboss.weld</groupId>
         <artifactId>weld-spi</artifactId>
      </dependency>
      <dependency>
         <groupId>javassist</groupId>
         <artifactId>javassist</artifactId>
      </dependency>
      <dependency>
         <groupId>com.google.collections</groupId>
         <artifactId>google-collections</artifactId>
      </dependency>
      <dependency>
         <groupId>javax.inject</groupId>
         <artifactId>javax.inject</artifactId>
      </dependency>
      <dependency>
         <groupId>org.jboss.interceptor</groupId>
         <artifactId>jboss-interceptor</artifactId>
      </dependency>
      <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-jdk14</artifactId>
         <scope>provided</scope>
      </dependency>
   </dependencies>

Integration Steps

Ensure that the weld integration tag is correct
  • Checkout the tag to be integrated. Ensure that there are no snapshot versions in it. Ensure it is buildable
Verify Weld Release Works In GlassFish (Assume for these instructions the version of Weld is 1.1.4.Final)
  • svn update GlassFish v3 source; Build GlassFish v3 source
  • Check out Weld source. Project Weld uses github to host sources https://github.com/weld, so the corresponding sources for a particular tag would be a " git checkout 1.1.4.Final" away. The relevant github repositories are parent, api and core.
  • Build the Weld source: mvn -U clean install. Build the weld-osgi-bundle: cd core/bundles/osgi; mvn -U clean install
  • Update the weld-version in top level GlassFish v3 pom.xml file to be 1.1.4.Final
  • Build v3/v3/web/weld-integration module
  • You may have to update the v3/v3/web/weld-integration-fragment module.  This fragment extends the weld osgi bundle to export additional packages from the weld-osgi-bundle as they are used in Weld generated proxies. Ideally you don't need to update this unless Weld proxies start using new packages (apart from the ones already exported in weld-integration-fragment's pom.xml.  If necessary modify the "Export-Package" tag in the maven-jar-plugin
  • Install Weld and Weld Integration modules in GlassFish: Copy the weld-osgi-bundle jar from weld/core workspace(core/bundles/osgi/target/weld-osgi-bundle-1.1.4.Final.jar) to glassfish/modules/weld-osgi-bundle.jar; Copy v3/web/weld-integration/target/weld-integration.jar to glassfish/modules (and v4/web/weld-integration-fragment/target/weld-integration-fragment.jar to glassfish/modules if necessary.)
  • Important :We have a quicklook test that verifies the exported packages in an installed and running Weld osgi bundle against expected exported packages specified in a properties file or the test. If any exported packages have changed in the Weld osgi pom.xml file, you will need to update a properties file for a Weld osgi quicklook test (unfortunately this is a manual process):
    • Determine the exported packages in the new Weld osgi bundle as it is running in GlassFish (you can use bnd tool or osgi command line)
    • Update the exports property in tests/quicklook/weld/osgiweld/metadata/weld-osgi.properties to reference the new exported package information.
  • Run Weld quicklook tests (under v3/tests/quicklook/weld)
  • Checkout, build, deploy and run the Weld examples numberguess, translator applications (github url: https://github.com/weld/core/tree/master/examples), other dev tests, etc.
  • Run CDI developer tests (PE/EE/Embedded mode) and CDI TCK
  • Follow the instructions at: CompleteInstructionsOnCommittingThirdPartySource for committing the Weld source to the GlassFish internal svn repository. There is already a https://svn.java.net/svn/glassfish~svn/trunk/external/modules/weld/ there, so it is just a matter of exporting the new Weld release. Make sure you modify build.properties under https://svn.java.net/svn/glassfish~svn/trunk/external/source-build/ to reference the new Weld release (change weld-core.svn.url and weld.version properties). Ensure that any new changes to the dependencies of Weld (such as javassist) are also added. These changes can be determined for any bom/pom.xml changes to the dependency element in weld-api and weld-core projects.
Test the source build:
Ensure weld api and core maven artifacts are published
  • If the tag that is being integrated is not a promoted build of Weld(for instance a private branch for GlassFish), it is likely that the maven artifacts are not published in the JBoss nexus repo. In that case, after the sources are imported into the glassfish source repo, request Jane (RE) to publish the weld api and core maven artifacts into the glassfish repo.
Get pom.xml changes reviewed

Send modified GlassFish v3 pom.xml file out for review to GlassFish developer alias. Check it in after getting approval.

Propagate changes(if any) to weld trunk

Make sure that any modifications to the Weld Osgi pom.xml file get propagated back into the JBoss Weld repository (most likely their trunk) so it can be picked up for the next Weld release from JBoss. Coordinate with JBoss when doing this.