Skip to content

Instantly share code, notes, and snippets.

View njbartlett's full-sized avatar

Neil Bartlett njbartlett

View GitHub Profile
[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
[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
ver: 2.10.0
Bundle-Version: ${ver}
Export-Package: *;version=${ver}
@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;
}
@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 / ExampleBundleTest.java
Created December 1, 2011 10:43
Java 7 OSGi testing ideas
public class ExampleBundleTest extends TestCase {
private final BundleContext context = FrameworkUtil.getBundle(ExampleBundleTest.class).getBundleContext();
public void testServiceAvailable() {
// Tests that a specific service exists and can be invoked successfully.
// The service reference is released automatically.
try (ServiceConsumer<MyService> svc = new ServiceConsumer<>(MyService.class, context)) {
assertEquals("Hello Neil", svc.get().sayHello("Neil"));
}
@njbartlett
njbartlett / gist:1298255
Created October 19, 2011 13:18
JVM stack dump
osgi> 2011-10-18 11:28:36
Full thread dump Java HotSpot(TM) Client VM (14.3-b01 mixed mode):
"[ThreadPool Manager] - Idle Thread" daemon prio=6 tid=0x35668c00 nid=0x1688 in Object.wait() [0x3715f000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x07220be8> (a org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor)
at java.lang.Object.wait(Object.java:485)
at org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor.run(Executor.java:106)
- locked <0x07220be8> (a org.eclipse.equinox.internal.util.impl.tpt.threadpool.Executor)
@Reference(type = '?')
public void setLog(LogService log) {
// ...
}
public void unsetLog(LogService log) {
// ...
}
@Reference(type = '*')
package org.example.gui;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.event.*;
import javax.swing.*;
import org.example.api.Greeting;
import aQute.bnd.annotation.component.*;
@Component
package org.example.impl;
import junit.framework.TestCase;
public class BasicGreetingTest extends TestCase {
public void testHello() {
assertEquals("Hello Fred", new BasicGreeting().sayHello("Fred"));
}
}