Trinidad use specific java 5 APIs so if you need to run Trinidad application in older you need to use a bytecode weaver like Retroweaver.
Build Trinidad for JDK 1.4
Use Maven
Start the Trinidad-build with -Dbuild.jdk14.compatible=true.
In the project where you want to use Trinidad in the 1.4 version, declare the dependencies as such - don't forget to include the retrotranslator library:
<!-- Apache MyFaces Trinidad (backported version) -->
<dependency>
<groupId>org.apache.myfaces.trinidad</groupId>
<artifactId>trinidad-api</artifactId>
<version>1.0.2</version>
<classifier>jdk14</classifier>
</dependency>
<dependency>
<groupId>org.apache.myfaces.trinidad</groupId>
<artifactId>trinidad-impl</artifactId>
<version>1.0.2</version>
<classifier>jdk14</classifier>
<!-- Exclude the trinidad-api dependency as
it would include the JDK5 version -->
<exclusions>
<exclusion>
<groupId>org.apache.myfaces.trinidad</groupId>
<artifactId>trinidad-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Retrotranslator runtime library -->
<dependency>
<groupId>net.sf.retrotranslator</groupId>
<artifactId>retrotranslator-runtime</artifactId>
<version>1.2.1</version>
</dependency>You are done - your project should work perfectly with JDK1.4 now. One final remark - do not use the retroweaved trinidad-jar-files with JDK1.5!
Alternatively, Do it yourself...
- Dowload Retroweaver
- Unzip Retroweaver in directory
- Create a directory named ext and Compile this class in it (if you use a jdk 5 compiler use -target 1.4 -source 1.4 command line parameter):
package net.sourceforge.retroweaver.runtime.java.lang;
public class ThreadLocal_
{
public static void remove(ThreadLocal threadLocal)
{
threadLocal.set(null);
}
}
- Weave Trinidad (for example with ant) (create weaved directory before executing this ant script)
<project name="retroweave.trinidad" default="weave" basedir=".">
<property name="retroweaver.home" location="your unziped retroweaver directory"/>
<property name="trinidad.version" value="1.0.0-incubating"/>
<property name="trinidad.api.jar.name" value="trinidad-api-${trinidad.version}.jar"/>
<property name="trinidad.impl.jar.name" value="trinidad-impl-${trinidad.version}.jar"/>
<taskdef name="retroweaver" classname="net.sourceforge.retroweaver.ant.RetroWeaverTask">
<classpath>
<fileset dir="${retroweaver.home}/lib" includes="**/*.jar" />
<fileset dir="${retroweaver.home}/release" includes="**/*.jar" />
<pathelement location="${retroweaver.home}/ext"/>
</classpath>
</taskdef>
<target name="weave" >
<retroweaver inputjar="${trinidad.api.jar.name}" outputjar="./weaved/${trinidad.api.jar.name}" target="1.4" verify="true"/>
<retroweaver inputjar="${trinidad.impl.jar.name}" outputjar="./weaved/${trinidad.impl.jar.name}" target="1.4" verify="true"/>
</target>
</project>
For running this solution you need to package your application with Trinidad weaved jar, retroweaver-rt-2.0.jar, backport-util-concurrent.jar and the ThreadLocal_ class