Wednesday, 29 May 2013

WorldClock and Lambdas

The second Java 8 feature to use in WorldClock are the Lambdas.
The simplest way to start using them seems to apply Netbeans refactoring hints.
These hints are of two kinds for WorldClock:

  • Iterations:
PreJava8:
for (City city : cities)
{
   city.paint(g, width, height, isFullScreen);
}
Java8:
cities.stream().forEach((city) ->
{
    city.paint(g, width, height, isFullScreen);
});
It may not bring much in this instance though.



  • Single method anonymous inner classes:
PreJava8:
mnuiShow.addActionListener(new ActionListener()
{
      @Override
      public void actionPerformed(ActionEvent e)
      {
        showWindow();
      }
});
Java8:
mnuiShow.addActionListener((ActionEvent e) ->
{
   showWindow();
});
There it does reduce the boiler plate code.

Sunday, 19 May 2013

WorldClock and JSR310

With JSR310 (Date and Time API) in Java 8 and the small 0.7 release of WorldClock done, I can update WorldClock to the new API.

First the time used for day and night drawing:
(in WorldClockBoard)
PreJava8:
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
int day = cal.get(Calendar.DAY_OF_MONTH);
int month = cal.get(Calendar.MONTH) + 1;
int year = cal.get(Calendar.YEAR);
int hours = cal.get(Calendar.HOUR_OF_DAY);
int minutes = cal.get(Calendar.MINUTE);
int seconds = cal.get(Calendar.SECOND);
Java8:
OffsetDateTime now = OffsetDateTime.now(ZoneOffset.UTC);
int day = now.getDayOfMonth();
int month = now.getMonthValue();
int year = now.getYear();
int hours = now.getHour();
int minutes = now.getMinute();
int seconds = now.getSecond();

Next the timezone and time formatting for a city:
(in City)
PreJava8:
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
//...

private final TimeZone tz;
private final Calendar cal;
private final SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
//...

// in the constructor
tz = TimeZone.getTimeZone(tzName);
cal = Calendar.getInstance(tz);
sdf.setTimeZone(tz);
//...

// in the paint method
cal.setTime(new Date());
final String time = sdf.format(cal.getTime());
Java8:
import java.time.Instant;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
//...

private final DateTimeFormatter formatter;
//...

// in the constructor
formatter = DateTimeFormatter.ofPattern("HH:mm").withZone(ZoneId.of(tzName));
//...

// in the paint method
final String time = formatter.format(Instant.now());

And the refresh ticker:
(in WorldClockPanel)
PreJava8:
private long last = 0;
//...

long now = System.currentTimeMillis() / 60000;
if (now > last)
Java8:
//(a bit verbose):
import java.time.Clock;
import java.time.Instant;
import java.time.ZoneId;
//...

private final Clock minuteClock = Clock.tickMinutes(ZoneId.systemDefault());
private Instant last = Instant.EPOCH;
//...

Instant now = minuteClock.instant();
if (now.isAfter(last))

Sunday, 21 April 2013

Worldclock 0.7, Worldclock Saver 0.8, Worldclock editor 1.0

Changes:
  • Built with Maven
  • Source and runtime upped to Java 7
  • Packaged as both zip archives and Windows setup program
  • First attempt at visually repositioning a city if it goes out of view
Download from http://worldclock-application.java.net/

Sunday, 24 March 2013

Building Jigsaw on Windows

Building Jigsaw on Windows is the same as building OpenJDK8 except that the URL to use in step 13 to get the root source is http://hg.openjdk.java.net/jigsaw/jigsaw/
hg clone http://hg.openjdk.java.net/jigsaw/jigsaw/
Post build define a JIG enviroment variable to prefix your java command:
 set JIG=C:\dev\jigsaw\build\windows-x86_64-normal-server-release\images\jdk-module-image
A few commands:
List the modules in the JDK system library:
 %JIG%/bin/jmod list
Launch a modular java application:
%JIG%/bin/java -m jdk.jconsole

Sunday, 20 January 2013

Building Java 8 on Windows

This post is a step by step to build Java 8 using the new build infrastructure on Window (8 64bits). It combines instructions from Volker Simonis, Stanislav Kobylansky and from the OpenJDK8 Build ReadMe.
A different version of these steps initiated by Patrick Reinhart can be found on the Adopt OpenJDK website.
One more version with screenshots by Roberto Coelho.

Last updated: 2013-10-11: added the direct link to VC++2010 web installer in English (for some reason it isn't available from the download page from France)
  1. Download Visual C++ 2010 Express (only C++ is needed, direct link), install it without optional products (ie without Silverlight or MS SQL 2008 Express SP1).
    (it is only needed to build Freetype)
  2. Download and install Windows SDK 7.1 (don't install the samples and .Net tools)
  3. Download and install Microsoft DirectX 9.0 SDK (the ReadMe says the version from summer 2004, however this does not seem to still be available from Microsoft, the version from June 2010 seems to be a working replacement)
  4. Download and install TortoiseHg (Mercurial client)
  5. Download and install Java 7 (if not already done)
  6. Download and install Cygwin in C:\cygwin64, select the following packages:
    • [Archive] unzip
    • [Archive] zip
    • [Base] gawk
    • [Devel] binutils
    • [Devel] make
    • [Interpreters] m4
    • [Utils] cpio
    • [Utils] files
    • [System] procps
  7. Create a C:\dev\ directory 
  8. Freetype
    1. Download the source
    2. Extract it to C:\dev\freetype-2.5.0.1
    3. Either
      • Download prebuilt binaries from bintray and extract them so that the lib directory goes into C:\dev\freetype-2.5.0.1
        or
      • Build it yourself
        1. Go to C:\dev\freetype-2.5.0.1\builds\win32\vc2010 and open freetype.sln
        2. Create a 64 bits configuration
          1. In the toolbar, click on the arrow by Win32, then on "Configuration Manager", then again click on Win32 below "Active solution platform", then on <New...>
          2. In the new dialog, call the new platform "x64" and copy its settings from Win32, click OK
          3. Back in the previous dialog select "Release Multithreaded" from "Active solution configuration" and Close
          4. Right click on the freetype project, then select Properties
          5. In the dialog adjust:
            • "Output Directory" from ".\..\..\..\objs\win32\vc2010\" to ".\..\..\..\lib\"
            •  "Intermediate Directory" from ".\..\..\..\objs\release_mt\" to ".\..\..\..\objs\release_mt_64\"
            •  "Target Name" from "freetype2411MT" to "freetype"
            •  "Platform Toolset" from "v100" to "Windows7.1SDK"
          6. Ok to save
          7. Right click on the freetype project then Build or press <F7> to build
          8. Once built, return to the properties dialog
            Change
            • "Configuration Type" from "Static library (.lib)" to "Dynamic Library (.dll)"
          9. Build again
     
  9. Copy msvcr100.dll to its own directory C:\dev\vcrt from either C:\Windows\System32 or C:\Program Files\Java\jdk1.7.0_XX\bin (this because the build process seem to have difficulties copying the file properly from C:\Windows\System32, and the JDK bin directory is in a path with spaces)
  10. Adjust the PATH by appending ";C:\cygwin64\bin"
  11. Open Cygwin terminal (from link on the desktop)
  12. cd /cygdrive/c/dev
  13. Get the root source:
    hg clone http://hg.openjdk.java.net/jdk8/jdk8
  14. Move to the new directory
    cd /cygdrive/c/dev/jdk8
  15. Get the remainder of the source
    ./get_source.sh 
  16. Force the permissions
    chmod -R u+rwxs /cygdrive/c/dev/jdk8
    (otherwise some files get access denied errors)
  17. Run the auto-conf script
    bash configure --with-freetype=/cygdrive/c/dev/freetype-2.5.0.1 --with-msvcr-dll=/cygdrive/c/dev/vcrt/msvcr100.dll
  18. Time for cooking
    make
  19. Once done, open a new standard Windows console and navigate to
    C:\dev\jdk8\build\windows-x86_64-normal-server-release\jdk
    check that java runs:
    bin\java -version
    or for something a bit more visual:
    bin\jconsole
  20. If needed make the images (ie the directory layouts that are created when installing a jdk/jre from the Oracle installers - or something pretty close to them)
    make images
  21. enjoy!
For day to day refresh do the following (in the cygwin shell):
  1. Go to the JDK directory
    cd /cygdrive/c/dev/jdk8
  2. Get the sources updates
    ./get_source.sh
  3. Force the permissions
    chmod -R u+rwxs /cygdrive/c/dev/jdk8
  4. Re-heat
    make
    or
    make images
  5. If it fails, try
    make clean
    (it tends to fail in hotspot, in which case a
    make clean-hotspot
    is faster)
    then re-heat
  6. If it fails again, try to redo the configuration
    make dist-clean
    bash configure --with-freetype=/cygdrive/c/dev/freetype-2.5.0.1 --with-msvcr-dll=/cygdrive/c/dev/vcrt/msvcr100.dll
    then re-heat

Sunday, 25 November 2012

Worldclock on Jigsaw and HK2

In the previous post I 'ported' HK2 to work on Jigsaw, in this post I adapt Worldclock to use it.

Retrieving the existing code:

svn checkout https://svn.java.net/svn/worldclock-application~svn/tags/application6-jigsaw-maven ~/dev/worldclock-hk2

And the new pom and module-info:

svn checkout https://svn.kenai.com/svn/lh-playground~svn/jigsaw/worldclock-hk2 ~/dev/worldclock-hk2-downloads

Panel

Overwrite the existing pom and module info for the panel:
cp ~/dev/worldclock-hk2-downloads/panel/pom.xml ~/dev/worldclock-hk2/panel/
(update the libraryDirectory path for your set up / username, gedit  ~/dev/worldclock-hk2/panel/pom.xml & )
cp  ~/dev/worldclock-hk2-downloads/panel/src/main/java/lh.worldclock.panel/module-info.java ~/dev/worldclock-hk2/panel/src/main/java/lh.worldclock.panel/
Add the sample HK2 dependency injection contract:
mkdir -p ~/dev/worldclock-hk2/panel/src/main/java/lh.worldclock.panel/lh/worldclock/hk2/
gedit ~/dev/worldclock-hk2/panel/src/main/java/lh.worldclock.panel/lh/worldclock/hk2/PanelProvider.java &
then add the content
package lh.worldclock.hk2;

import lh.worldclock.core.WorldClockBoard;
import org.jvnet.hk2.annotations.Contract;

@Contract
public interface PanelProvider
{
  WorldClockBoard getPanel();
}

Add the sample HK2 dependency injection service:
gedit ~/dev/worldclock-hk2/panel/src/main/java/lh.worldclock.panel/lh/worldclock/hk2/PanelProviderImpl.java &
then add the content
package lh.worldclock.hk2;

import lh.worldclock.core.WorldClockBoard;
import org.jvnet.hk2.annotations.Service;

@Service
public class PanelProviderImpl implements PanelProvider
{
  @Override
  public WorldClockBoard getPanel()
  {
    return new WorldClockBoard();
  }
}
build
cd ~/dev/worldclock-hk2/panel/
mvn -Dmaven.test.skip=true clean install
(if the build fail due to  invalid characters, edit the file and remove the comments
gedit ~/dev/worldclock-hk2/panel/src/main/java/lh.worldclock.panel/lh/worldclock/core/WorldClockBoard.java & )


Application


Overwrite the existing pom and module info for the application:
cp ~/dev/worldclock-hk2-downloads/application/pom.xml ~/dev/worldclock-hk2/application/
(update the libraryDirectory path for your set up / username, gedit  ~/dev/worldclock-hk2/application/pom.xml & )
cp  ~/dev/worldclock-hk2-downloads/application/src/main/java/lh.worldclock.application/module-info.java ~/dev/worldclock-hk2/application/src/main/java/lh.worlclock.application/

Adjust WorldClockPanel:
gedit ~/dev/worldclock-hk2/application/src/main/java/lh.worlclock.application/lh/worldclock/WorldClockPanel.java &

replace constructor start with:
   public WorldClockPanel(final WorldClockBoard board)
  {
//    board = new WorldClockBoard();
    this.board = board;
Adjust WorldClockFrame:
gedit ~/dev/worldclock-hk2/application/src/main/java/lh.worlclock.application/lh/worldclock/WorldClockFrame.java &

add import
 import lh.worldclock.core.WorldClockBoard;

remove the initialisation of pane
 WorldClockPanel pane;

replace constructor start with:
   public WorldClockFrame(ImageIcon icon, final WorldClockBoard board)
  {
    pane = new WorldClockPanel(board);
Adjust WorldClock
gedit ~/dev/worldclock-hk2/application/src/main/java/lh.worlclock.application/lh/worldclock/WorldClock.java &

add imports
import com.sun.enterprise.module.bootstrap.ModuleStartup;
import com.sun.enterprise.module.bootstrap.StartupContext;
import org.jvnet.hk2.annotations.Inject;
import org.jvnet.hk2.annotations.Service;
import lh.worldclock.core.WorldClockBoard;

replace class declaration
    @Service
    public class WorldClock implements ModuleStartup

make the frame non static
/*static*/ WorldClockFrame frame = null;
 add the injection
   @Inject
  WorldClockBoard board;
make main method non static

make void showWindow() non static and change
frame = new WorldClockFrame(icon, board);

to add the board

make   private PopupMenu createPopup() non static

add the following new methods
  public void setStartupContext(StartupContext context)
  {
  }

  public void start()

  {
    main(new String[]{});
  }

  public void stop()
  {
  }
build
cd ~/dev/worldclock-hk2/application/
mvn -Dmaven.test.skip=true clean install

Time to run:
cd ~/dev/hk2-jigsaw/jigsaw-adapter/
mvn lh.jigsaw:jigsaw-maven-plugin:run

HK2 and Jigsaw


In 2007, Jerôme Dochez presented HK2 as a module system loosely based on JSR277, I tend to see Jigsaw as the continuation of JSR277, so I wanted to see how HK2 could interface with Jigsaw.

Setting up the environement:

1. Build Jigsaw
2. Build the Maven plugin for Jigsaw
3. Download and extract Maven 3 in ~/dev
4. Export the variables:
export M2_HOME=~/dev/apache-maven-3.0.4/
export MAVEN_HOME=~/dev/apache-maven-3.0.4/
export JAVA_HOME='/usr/lib/jvm/java-7-openjdk-i386'
export PATH=$JAVA_HOME/bin:$M2_HOME/bin:$PATH
give some extra room to Maven:
export MAVEN_OPTS="-XX:PermSize=64M -XX:MaxPermSize=128M"

Get and build HK2:

svn checkout https://svn.java.net/svn/hk2~svn/tags/hk2-parent-1.6.32 ~/dev/hk2-1.6.32
cd ~/dev/hk2-1.6.32
mvn -DskipTests=true -Prelease-phase1 clean install
mvn -DskipTests=true clean install

Get the additions/replacements:

In order to reduce the amount of typing/copying some of the added/modified files are downloadable.
svn checkout https://svn.kenai.com/svn/lh-playground~svn/jigsaw/hk2 ~/dev/hk2-jigsaw-downloads

Patch HK2:

HK2 1.6.32 still uses the APT to build, this is removed from Java8/Jigsaw, so some adjustments are needed. These replace APT API with JSR269 API.
cd ~/dev/hk2-1.6.32/
patch -p0 < ~/dev/hk2-jigsaw-downloads/hk2-1.6.32-java7-maven-plugin.diff
as a result of the patch some of the tests in HK2 are failing, so disabling them for now
gedit ~/dev/hk2-1.6.32/pom.xml &
then comment line  307 (<module>auto-depends-tests</module>).
Build the patched version:
mvn -DskipTests=true clean install

Clean up no longer needed classes from the Maven plugin:

rm -f ~/dev/hk2-1.6.32/hk2-maven-plugin/src/main/java/com/sun/enterprise/module/maven/CompositeAnnotationProcessorFactory.java
rm -f ~/dev/hk2-1.6.32/hk2-maven-plugin/src/main/java/com/sun/enterprise/module/maven/AptInvoker.java
rm -f ~/dev/hk2-1.6.32/hk2-maven-plugin/src/main/java/com/sun/enterprise/module/maven/AptCompiler.java

Adjust hk2-maven-plugin for Jigsaw:

Replace components.xml with a version that defines the packaging type to hk2-jmod rather than hk2-jar, and that also adds the Jigsaw extensions.
 cp ~/dev/hk2-jigsaw-downloads/hk2-1.6.32/hk2-maven-plugin/src/main/resources/META-INF/plexus/components.xml ~/dev/hk2-1.6.32/hk2-maven-plugin/src/main/resources/META-INF/plexus/components.xml
Adjust  PackageMojo:
gedit ~/dev/hk2-1.6.32/hk2-maven-plugin/src/main/java/com/sun/enterprise/module/maven/PackageMojo.java &
replace line 109:
@parameter expression="${component.org.codehaus.plexus.archiver.Archiver#jar}"
with
@component role="org.codehaus.plexus.archiver.Archiver" roleHint="jar"

Adjust RunMojo:
gedit ~/dev/hk2-1.6.32/hk2-maven-plugin/src/main/java/com/sun/enterprise/module/maven/RunMojo.java &

set the goal to hk2-run on line 65 so that the default run is the Jigsaw run

Add the non compile parts from the Jigsaw Maven plugin and override the compile part:
cp -r ~/dev/jigsaw-maven-plugin/src/main/java/lh ~/dev/hk2-1.6.32/hk2-maven-plugin/src/main/java/
mv  ~/dev/hk2-1.6.32/hk2-maven-plugin/src/main/java/lh/jigsaw/plugin/AbstractCompilerMojo.java ~/dev/hk2-1.6.32/hk2-maven-plugin/src/main/java/com/sun/enterprise/module/maven/
mv  ~/dev/hk2-1.6.32/hk2-maven-plugin/src/main/java/lh/jigsaw/plugin/CompilerMojo.java ~/dev/hk2-1.6.32/hk2-maven-plugin/src/main/java/com/sun/enterprise/module/maven/
Adjust  AbstractCompilerMojo:
gedit  ~/dev/hk2-1.6.32/hk2-maven-plugin/src/main/java/com/sun/enterprise/module/maven/AbstractCompilerMojo.java &

replace the package
package lh.jigsaw.plugin;
with
package com.sun.enterprise.module.maven;


Adjust CompilerMojo:
gedit  ~/dev/hk2-1.6.32/hk2-maven-plugin/src/main/java/com/sun/enterprise/module/maven/CompilerMojo.java &

replace the package
package lh.jigsaw.plugin;
with
package com.sun.enterprise.module.maven;

Adjust the pom:
gedit ~/dev/hk2-1.6.32/hk2-maven-plugin/pom.xml &
Add to the build:
         <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
                <dependencies>
                   <dependency>
                     <groupId>org.codehaus.plexus</groupId>
                     <artifactId>plexus-compiler-javac</artifactId>
                     <version>1.8.1-jigsaw</version>
                     <exclusions>
                        <exclusion>
                          <groupId>org.codehaus.plexus</groupId>
                          <artifactId>plexus-component-api</artifactId>
                        </exclusion>
                     </exclusions>
                  </dependency>
                </dependencies>
            </plugin>
        </plugins>
Replace the auto-depends-plugin dependency with:
         <dependency>
            <groupId>org.glassfish.hk2</groupId>
            <artifactId>auto-depends-plugin</artifactId>
            <version>${project.version}</version>
            <exclusions>
              <exclusion>
                <groupId>com.sun</groupId>
                <artifactId>tools</artifactId>
              </exclusion>
            </exclusions>
        </dependency>
Replace the plexus-compiler-javac dependency with:
     <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-compiler-javac</artifactId>
      <version>1.8.1-jigsaw</version>
      <exclusions>
        <exclusion>
          <groupId>org.codehaus.plexus</groupId>
          <artifactId>plexus-component-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
Build the modified plugin with Jigsaw:
export JAVA_HOME=~/dev/jigsaw/build/linux-i586/jdk-module-image
cd ~/dev/hk2-1.6.32/hk2-maven-plugin/
mvn clean install

Make (parts of) hk2 Jigsaw friendly (ie Jigsaw projects):


JSR330 support
mkdir ~/dev/hk2-jigsaw
cp -r ~/dev/hk2-jigsaw-downloads/hk2-jigsaw/hk2jsr330/ ~/dev/hk2-jigsaw/
cd ~/dev/hk2-jigsaw/hk2jsr330/
mvn -Dmaven.test.skip=true clean install
(update the libraryDirectory path for your set up / username, gedit ~/dev/hk2-jigsaw/hk2jsr330/pom.xml & )
 
HK2-API
cp  ~/dev/hk2-jigsaw-downloads/hk2-1.6.32/hk2-api/pom.xml ~/dev/hk2-1.6.32/hk2-api/
(update the libraryDirectory path for your set up / username, gedit  ~/dev/hk2-1.6.32/hk2-api/pom.xml & )

mkdir ~/dev/hk2-1.6.32/hk2-api/src/main/java/lh.jigsaw.hk2.api
mv  ~/dev/hk2-1.6.32/hk2-api/src/main/java/org/  ~/dev/hk2-1.6.32/hk2-api/src/main/java/lh.jigsaw.hk2.api/
cp  ~/dev/hk2-jigsaw-downloads/hk2-1.6.32/hk2-api/src/main/java/lh.jigsaw.hk2.api/module-info.java ~/dev/hk2-1.6.32/hk2-api/src/main/java/lh.jigsaw.hk2.api/
build
cd ~/dev/hk2-1.6.32/hk2-api/
mvn -Dmaven.test.skip=true clean install

Auto-depends
cp  ~/dev/hk2-jigsaw-downloads/hk2-1.6.32/auto-depends/pom.xml ~/dev/hk2-1.6.32/auto-depends/
(update the libraryDirectory path for your set up / username, gedit  ~/dev/hk2-1.6.32/auto-depends/pom.xml & )
mkdir ~/dev/hk2-1.6.32/auto-depends/src/main/java/lh.jigsaw.hk2.autodepends
mv ~/dev/hk2-1.6.32/auto-depends/src/main/java/org/ ~/dev/hk2-1.6.32/auto-depends/src/main/java/lh.jigsaw.hk2.autodepends
mv ~/dev/hk2-1.6.32/auto-depends/src/main/java/com/ ~/dev/hk2-1.6.32/auto-depends/src/main/java/lh.jigsaw.hk2.autodepends
cp  ~/dev/hk2-jigsaw-downloads/hk2-1.6.32/auto-depends/src/main/java/lh.jigsaw.hk2.autodepends/module-info.java ~/dev/hk2-1.6.32/auto-depends/src/main/java/lh.jigsaw.hk2.autodepends/
build
cd ~/dev/hk2-1.6.32/auto-depends/
mvn -Dmaven.test.skip=true clean install
HK2-Core
cp  ~/dev/hk2-jigsaw-downloads/hk2-1.6.32/core/pom.xml ~/dev/hk2-1.6.32/core/
(update the libraryDirectory path for your set up / username, gedit  ~/dev/hk2-1.6.32/core/pom.xml & )


mkdir ~/dev/hk2-1.6.32/core/src/main/
mv  ~/dev/hk2-1.6.32/core/src/java ~/dev/hk2-1.6.32/core/src/main/
mkdir ~/dev/hk2-1.6.32/core/src/main/java/lh.jigsaw.hk2.core
mv  ~/dev/hk2-1.6.32/core/src/main/java/com ~/dev/hk2-1.6.32/core/src/main/java/lh.jigsaw.hk2.core/
cp  ~/dev/hk2-jigsaw-downloads/hk2-1.6.32/core/src/main/java/lh.jigsaw.hk2.core/module-info.java ~/dev/hk2-1.6.32/core/src/main/java/lh.jigsaw.hk2.core/
build
cd ~/dev/hk2-1.6.32/core/
mvn -Dmaven.test.skip=true clean install 

Add the adapter for Jigsaw:

The adapter only implements the minimum required to start HK2 over Jigsaw and inject a dependency in a program. It inspired by both the initial HK2 launcher and the OSGi adapter. The Jigsaw interaction bits are in JigsawFactory (obtain a library instance), JigsawModuleDefinition (obtain the inhabitants file content from the Jisaw library for a module), JigsawModulesRegistry (obtain a class loader for a module).
cp -r  ~/dev/hk2-jigsaw-downloads/hk2-jigsaw/jigsaw-adapter ~/dev/hk2-jigsaw/
cd ~/dev/hk2-jigsaw/jigsaw-adapter
mvn -Dmaven.test.skip=true clean install

Let's us it:

See  Worldclock on Jigsaw and HK2