First Things to Do in a Confluence Skeleton Plugin

Posted by admin on April 19th, 2014 filed in Development, Java, Wiki

Here are the first things I do right after creating and testing the skeleton project of an advanced Confluence Bluepint plugin.

In atlassian-plugin.xml (the plugin descriptor), do the following:

  • Here you link an icon and logo in the <plugin-info> element. Copy your organization icon and logo PNG files to the “images/” directory (as you see it done in the skeleton project).
  • Be aware for the future that, every time you add an XML, Soy, Java, or JavaScript file, you have to declare that here. I’ll go into more detail in another blog article.

In the pom.xml, do the following:

  1. Specify your organization name and url.
            <name>Company Inc</name>

    Here is also where you set the plugin version from SNAPSHOT to 1.0 when you release it.

  2. Add your current maven-compiler-plugin version. Run atlas-version to find out what it is.
  3. I set the confluence version property to a stable release (5.3). By default it was a dot release (5.4.3 or 5.4.4) which threw lots of errors for me for some reason.
  4. Apparently the plugin’s <name> is lost by the wizard and not set in the skeleton, so I retyped it.

In the XML, SOY, and Java files, do the following:

  1. src\main\resources\ — Define all static UI text using Java-style .properties resourceBundle files. UI text includes text in wizard dialogs (dialog-wizard.js), wizard error messages, placeholder text, the page template (article-template.xml), the plugin name, and description. Using ResourceBundles consistently will make localization and text changes easy later.
  2. src\main\resources\soy\ — Here you define the form fields of the wizard UI. You link input fields to Java context variables through the “name=” attribute.
    In the following example, the text field with id customername is linked to the Java variable customerName. The static text is defined in the .properties file as my.blueprint.form.label.title.customername.

    {namespace MyPlugin.Blueprints.Simple}
    *  A simple wizard form that accepts a person's name
    {template .page1Form}
        <form action="#" method="post" class="aui">
            <div class="field-group">
                <label for="customername">{getText(
                <input id="customername" class="text" type="text" name="customerName">
  3. src\main\resources\xml\article-template.xml: Define the blueprint template for your new page. This file contains static HTML text, and dynamic <at:var> variables.
    1. Define dynamic variables through context.put(myVariable,"blah"); in, and then use them here through <at:var at:name="myVariable" /> .
    2. Define static text in the .properties files and use it here through <ac:placeholder><at:i18n at:key="" /></ac:placeholder> .
  4. src\main\java\ — Write your ContextProvider (to define dynamic data for substitution in the article template’s <at:var> elements), write your EventListener (to run Java code after page creation), and write your serialization classes.
    Tip: In the ContextProvider, I changed the declaration to
    public class ContentTemplateContextProvider extends AbstractBlueprintContextProvider.

Sources: simple blueprint plugin, intermediate blueprint plugin, advanced blueprint plugin

Comments are closed.