Extending the Confluence Search Index

Developing plugins for the Confluence Wiki a developer sometimes needs to save additional metadata to a page object using Bandana or the ContentPropertyManager. Wouldn’t it be nice if this metadata was available in the built-in Lucene index? That is were the Confluence Extractor Module comes into play.. Overview An extractor allows the developer to add new fields to the lucene search index. Creating a new extractor is quite simple – just implement the interface com.atlassian.bonnie.search.Extractor or bucket.search.lucene.extractor.BaseAttachmentContentExtractor if you want to build a new file extractor. ...

May 23, 2010 · 4 min · 713 words · Micha Kops

A look at Maven 3 alpha

We are all waiting for a stable release of Maven3 with following updates .. faster, more performant .. save us time building our software and some precious memory ;) improved artifact resolution api and plugin api better osgi integration a few bugfixes no mixing of application dependencies and tooling dependencies though it does not matter that much to me: polyglot features .. e.g.: “Writing your pom files in Groovy” version-less parent elements for multi-module or multi-pom projects, no need to define the parent version in every submodule better artifact resolution, which dependency or pom supplied which artifact to the outcome .. got that information from: “Splitter from the world of Java” ...

May 22, 2010 · 2 min · 219 words · Micha Kops

Signing APK with the Maven-Jar-Signer Plugin

There is a nice Maven plugin helping you signing your Android app – the Maven Jar Signer Plugin. If you want to learn more about Maven integration in an android project take a look at this article. Maven Profile Setup Add the following code to your pom.xml <?xml version="1.0"?> <profiles> <profile> <id>sign</id> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jarsigner-plugin</artifactId> <version>1.2</version> <executions> <execution> <id>signing</id> <goals> <goal>sign</goal> </goals> <phase>package</phase> <inherited>true</inherited> <configuration> <archiveDirectory/> <includes> <include>target/*.apk</include> </includes> <keystore>path/to/keystore</keystore> <storepass>storepasword</storepass> <keypass>keypassword</keypass> <alias>key-alias</alias> </configuration> </execution> </executions> </plugin> <plugin> <groupId>com.jayway.maven.plugins.android.generation2</groupId> <artifactId>maven-android-plugin</artifactId> <inherited>true</inherited> <configuration> <sign> <debug>false</debug> </sign> </configuration> </plugin> </plugins> </build> </profile> </profiles> ...

April 17, 2010 · 1 min · 155 words · Micha Kops

Coding Katas with Maven

Searching for nice coding kata sites I found this one – codingkata.org – I really liked because of the quick start and nice maven integration. Just head over to the kata overview select the kata you wish to try out, copy the generated maven command line option and run it in the console – heres the code for the hello-world sample: Coding Katas from Maven Archetype mvn archetype:generate -DinteractiveMode=false -DarchetypeRepository=http://www.codingkata.org/repo/release -DarchetypeGroupId=org.codingkata.template -DarchetypeArtifactId=solv-java-archetype -DarchetypeVersion=1.04 -DgroupId=org.codingkata.unit -DartifactId=hello-world-solv-java -DkataId=hello-world -DkataVersion=1.02 -DlangVersion=1.6 -DlibVersion=1.3.2 -Dversion=1271358 ...

April 15, 2010 · 2 min · 236 words · Micha Kops

How to build a Confluence Macro Plugin

The goal is to build a small macro plugin deployable via the Confluence plugin API rendering some spaces. Please note that I am going to build the plugin using just Maven and not the Atlassian Maven Wrapper called the “Atlassian Plugin SDK” – more information about that is available at the Atlassian website. The macro output will be rendered using a Velocity template and all messages are stored for i18n in properties files bundled with the plugin. ...

April 13, 2010 · 7 min · 1431 words · Micha Kops

Create a SOAP client using the JAX-WS Maven Plugin

Having written the article “How to build a Confluence SOAP client in 5 minutes” some readers asked me for some more information and help using the JAX-WS plugin that I mentioned in the article instead of the Axis plugin – so here we go ;) Steps Create a simple maven project first using archetype:create or archetype:generate mvn archetype:create -DgroupId=com.hascode.jaxws -DartifactId=soap-tutorial We get a pom.xml like this: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.hascode.jaxws</groupId> <artifactId>soap-tutorial</artifactId> <version>0.1</version> </project> ...

April 8, 2010 · 3 min · 530 words · Micha Kops

Manage dependencies with the Maven Dependency Plugin

In a maven project there are lots of dependencies to handle – often one wants to know which version of a software comes from. The solution to this problem is the Maven Dependency Plugin which helps you to find used/unused/declared/undeclared dependencies in your project. In addition the plugin allows you to copy or unpack artifacts. Maven Goals dependency:copy – copies artifacts defined in the config to a specified location – details available here dependency:resolve – resolves all dependencies and shows the versions dependency:go-offline – resolves everything the project needs like dependencies, plugins and reports dependency:analyze - parses the dependencies and shows if they are used/declared/unused/undeclared .. dependency:analyze-dep-gmt - finds mismatches between resolved dependencies and those listed in the dependencyManagement section dependency:tree – shows a nice dependency tree for the maven project ...

April 4, 2010 · 2 min · 321 words · Micha Kops

Snippet: Simple One-Minute IMAP Client

Building a simple IMAP Client that displays the subject of the messages in the “inbox” Folder using Maven (I just like Maven). Project Setup / Maven Create a new Maven project mvn archetype:create -DgroupId=com.hascode.imap -DartifactId=imap-client Edit your pom.xml and add some dependencies <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.hascode.imap</groupId> <artifactId>imap-client</artifactId> <version>0.0.1-SNAPSHOT</version> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.1</version> </dependency> <dependency> <groupId>javax.mail</groupId> <artifactId>mail</artifactId> <version>1.4.2</version> </dependency> </dependencies> </project> Creating the E-Mail Client Create a package .. something like com.hascode.imap.client ;) Create a simple mail client using javax.mail in a class named ImapClient package com.hascode.imap.client; import javax.mail.Folder; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.Store; public class ImapClient { private Session session = null; private Store store = null; private String host = null; private String userName = null; private String password = null; public ImapClient(String host, String userName, String password){ this.host = host; this.userName = userName; this.password = password; } public boolean getMail() throws MessagingException { session = Session.getDefaultInstance(System.getProperties(),null); // session.setDebug(true); System.out.println("get store.."); store = session.getStore("imaps"); System.out.println("connect.."); store.connect(this.host, this.userName, this.password); System.out.println("get default folder .."); Folder folder = store.getDefaultFolder(); folder = folder.getFolder("inbox"); folder.open(Folder.READ_ONLY); System.out.println("reading messages.."); Message[] messages = folder.getMessages(); for(Message m:messages){ System.out.println(m.getSubject()); } return false; } } ...

April 3, 2010 · 2 min · 295 words · Micha Kops

How to integrate Android Development Tools and Maven

With the Maven Android Plugin it is possible to build and deploy/undeploy your android app and start/stop the emulator – if you’re used to maven you won’t be going without it ;) If you’re interested in signing your apk using maven – take a look at this article Project Setup Create an android project using the android tool We need some dependencies – so create a pom.xml in the project’s root directory – I took this from the plugin samples and modified it: <?xml version="1.0" encoding="UTF-8"?> <!-- Copyright (C) 2009 Jayway AB Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.hascode.android.app</groupId> <artifactId>demo</artifactId> <packaging>apk</packaging> <name>hasCode.com - Sample Android App using the Maven Android Plugin</name> <version>0.1</version> <dependencies> <dependency> <groupId>android</groupId> <artifactId>android</artifactId> <version>2.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.1</version> <scope>test</scope> </dependency> </dependencies> <build> <!--<finalName>${artifactId}</finalName>--> <plugins> <plugin> <groupId>com.jayway.maven.plugins.android.generation2</groupId> <artifactId>maven-android-plugin</artifactId> <configuration> <sdk> <path>${env.ANDROID_HOME}</path> <platform>3</platform> </sdk> <deleteConflictingFiles>true</deleteConflictingFiles> </configuration> <extensions>true</extensions> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.5</source> <target>1.5</target> </configuration> </plugin> </plugins> </build> </project> ...

April 2, 2010 · 3 min · 453 words · Micha Kops

How to build a Confluence SOAP client in 5 minutes

In this tutorial we are going to build a SOAP client for the popular Confluence Wiki in about five minutes. The client is going to receive rendered HTML Markup from a specified Confluence Page. Prerequisites A running Confluence Installation with SOAP API enabled – if you don’t already have one take a look at this article or if you’ve got the Atlassian Plugin SDK installed .. start a standalone instance using atlas-run-standalone .. Maven – never go without it ;) Five minutes of your life time .. ...

March 28, 2010 · 3 min · 537 words · Micha Kops