Skip to content

Instantly share code, notes, and snippets.

View njbartlett's full-sized avatar

Neil Bartlett njbartlett

View GitHub Profile
@njbartlett
njbartlett / gist:1980400
Created March 5, 2012 19:06
How scalac reports that joda-time is missing from the classpath...
[scalac] exception when typing net.liftweb.util.Helpers.bind
[scalac] exception when typing net.liftweb.util.Helpers.bind("calc", xhtml, scala.this.Predef.wrapRefArray(Array[net.liftweb.util.BindHelpers#BindParam]{net.liftweb.util.Helpers.strToSuperArrowAssoc("equals").->({
[scalac] {
[scalac] var $md: scala.xml.MetaData = scala.xml.Null;
[scalac] $md = new scala.xml.UnprefixedAttribute("onclick", net.liftweb.http.SHtml.ajaxCall(new net.liftweb.http.js.JE#ValById("screen"), {
[scalac] {
[scalac] @SerialVersionUID(0) final <synthetic> class $anonfun extends scala.runtime.AbstractFunction1 with Serializable {
[scalac] def this($outer: code.snippet.CalcSnippet): anonymous class $anonfun = {
[scalac] $anonfun.super.this();
[scalac] ()
@njbartlett
njbartlett / gist:2638180
Created May 8, 2012 18:17
Building an index for OSGi service properties
public class IndexingTracker extends ServiceTracker {
private final ConcurrentMap<Object, ServiceReference> index = new ConcurrentHashMap<Object, ServiceReference>();
private final String keyProperty;
public IndexingTracker(BundleContext context, String serviceClass, String keyProperty) {
super(context, serviceClass, null);
this.keyProperty = keyProperty;
}
ver: 2.10.0
Bundle-Version: ${ver}
Export-Package: *;version=${ver}
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project org.sonatype.nexus.plugins:nexus-obr-plugin:2.0.3-SNAPSHOT (/Users/njbartlett/Development/nexus/
nexus-obr-plugin/nexus-obr-plugin/pom.xml) has 2 errors
[ERROR] Unresolveable build extension: Plugin org.sonatype.plugins:app-lifecycle-maven-plugin:1.6 or one of its de
pendencies could not be resolved: The following artifacts could not be resolved: javax.inject:javax.inject:jar:1, org.
apache.maven.plugins:maven-assembly-plugin:jar:2.2-beta-5, org.apache.maven.scm:maven-scm-api:jar:1.4, org.apache.mave
n.scm:maven-scm-manager-plexus:jar:1.4, org.apache.maven.scm:maven-scm-provider-svnexe:jar:1.4, org.apache.maven.scm:m
aven-scm-provider-svn-commons:jar:1.4, org.apache.maven.scm:maven-scm-provider-gitexe:jar:1.4, org.apache.maven.scm:maven-scm-provider-git-commons:jar:1.4, org.apache.maven.scm:maven-scm-provider-hg:jar:1.4: Could not find artifact java
x.inject:javax.inject:jar:1 in sonatype-forge (https://repository.sona
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Nexus OBR (Parent)
[INFO] Nexus OBR :: Plugin
[INFO] Nexus OBR :: Testsuite
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Nexus OBR (Parent) 2.0.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5:09.370s
[INFO] Finished at: Tue Oct 02 17:01:52 BST 2012
[INFO] Final Memory: 142M/268M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonatype.nexus.plugins:nexus-test-environment-maven-plugin:2.3-SNAPSHOT:setup-environment (default) on project nexus-ldap-plugin-it: Execution default of goal org.sonatype.nexus.plugins:nexus-test-environment-maven-plugin:2.3-SNAPSHOT:setup-environment failed: Plugin org.sonatype.nexus.plugins:nexus-test-environment-maven-plugin:2.3-SNAPSHOT or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.sonatype.aether:aether-util:jar:1.13.1, org.sonatype.plexus:plexus-cipher:jar:1.5, org.sonatype.plugins:port-allocator-maven-plugin:jar:1.2: Failure to transfer org.sonatype.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] Nexus OBR (Parent)
[INFO] Nexus OBR :: Plugin
[INFO] Nexus OBR :: Testsuite
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Nexus OBR (Parent) 2.0.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
@njbartlett
njbartlett / gist:3874679
Created October 11, 2012 18:52
p2 repository in ANT
<!-- Generate the p2 repository and index -->
<target name="p2" depends="build,features.dir,plugins.dir" description="Generate the p2 repository">
<java jar="${workspacedir}/cnf/eclipse-3.5.2/plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar" fork="true" failonerror="true">
<!-- <arg line="-consoleLog"/> -->
<arg line="-application org.eclipse.ant.core.antRunner"/>
<arg line="-data ${target}"/>
<arg line="-buildfile build.xml __internal_p2"/>
</java>
<!-- Append the category info -->
@njbartlett
njbartlett / gist:4266809
Created December 12, 2012 10:42
Gatekeeper component example
package org.example.exchange.gatekeeper;
import java.io.File;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.example.osgi.utils.components.ComponentHelper;
import org.osgi.service.component.ComponentContext;
@njbartlett
njbartlett / gist:4268406
Created December 12, 2012 15:00
OSGi bundle unit testing
package org.example.tests;
import junit.framework.TestCase;
import org.example.exchange.api.Exchange;
import org.example.exchange.api.ExchangeListener;
import org.example.model.orders.Order;
import org.example.model.orders.OrderHelper;
import org.example.model.orders.Side;
import org.mockito.Mockito;