Confluence Helloworld macro from SDK tutorials is not loading in macro browser
Asked by Matt Leary:

Hi,

I'm trying to follow the [Create a Confluence 'Hello World' Macro](https://developer.atlassian.com/docs/getting-started/set-up-the-atlassian-plugin-sdk-and-build-a-project/create-a-confluence-hello-world-macro "Create a Confluence 'Hello World' Macro") tutorial but upon reaching the 'Create a Macro Element in Confluence' step, my helloworld macro fails to appear in the macro browser.

![confluence-macro-test.gif](/t5/image/serverpage/image-id/5269i338CB6F492423A09/image-dimensions/446x257?v=v2 "confluence-macro-test.gif")

From the tutorial, the atlassian-plugin.xml was updated to include xhtml-macro tag:  

```
<xhtml-macro name="helloworld" class="com.atlassian.tutorial.macro.helloworld" key='helloworld-macro'>
  <description key="helloworld.macro.desc"/>
  <category name="formatting"/>
  <parameters/>
</xhtml-macro>
```

The properties for the plugin were updated:  

```
#put any key/value pairs here
my.plugin.name=MyPlugin
helloworld.macro.desc="Hello World"
```

I also added the helloworld.java file in **/src/main/java/com/atlassian/tutorial/macro:**  

```
package com.atlassian.tutorial.macro;

import com.atlassian.confluence.content.render.xhtml.ConversionContext;
import com.atlassian.confluence.macro.Macro;
import com.atlassian.confluence.macro.MacroExecutionException;

import java.util.Map;

public class helloworld implements Macro {

  public String execute(Map<String, String> map, String s, ConversionContext conversionContext) throws MacroExecutionException {
    return "<h1>Hello World!</h1><h2>Test</h2>";
  }

  public BodyType getBodyType() { return BodyType.NONE; }

  public OutputType getOutputType() { return OutputType.BLOCK; }

}
```

![2017-08-28 11_29_51-helloworld.java ? jira-plugins ? Visual Studio Code.png](/t5/image/serverpage/image-id/5270i7472E233FFA7CCB4/image-size/large?v=v2&px=999 "2017-08-28 11_29_51-helloworld.java ? jira-plugins ? Visual Studio Code.png")  
I then ran **atlas-mvn package** as in the tutorial but that did not allow me to select the helloworld macro from the macro browser. I've also tried **ctrl + Z**shutting down the sdk application instances and restarting.  
Is there a step missing from the tutorial?  
Are there any known issues with the version of the sdk / application I'm running?  
- confluence version: 5.10.7  
- confluence data version: 5.10.5  
- amps version: 6.2.11  
- ATLAS Version: 6.2.14  
- Java version: 1.8.0_121  
Thanks,  
Matt


Answers:
author: Matt Leary
body: Eventually I tried pulling the source code from [bitbucket](https://bitbucket.org/serverecosystem/myconfluencemacro/src "bitbucket"). I'd made a simple mistake and added the **xhtml-macro** tag as a child of the **web-resource** tag instead of after it:  

```
<web-resource key="myConfluenceMacro-resources" name="myConfluenceMacro Web Resources">
  <dependency>com.atlassian.auiplugin:ajs</dependency>

  <resource type="download" name="myConfluenceMacro.css" location="/css/myConfluenceMacro.css"/>
  <resource type="download" name="myConfluenceMacro.js" location="/js/myConfluenceMacro.js"/>
  <resource type="download" name="images/" location="/images"/>

  <context>myConfluenceMacro</context>

  <xhtml-macro name="helloworld" class="com.atlassian.tutorial.macro.helloworld" key='helloworld-macro' hidden="false">
    <description key="helloworld.macro.desc"/>
    <category name="formatting"/>
    <parameters />
  </xhtml-macro>
</web-resource>
```

```
<web-resource key="myConfluenceMacro-resources" name="myConfluenceMacro Web Resources">
  <dependency>com.atlassian.auiplugin:ajs</dependency>

  <resource type="download" name="myConfluenceMacro.css" location="/css/myConfluenceMacro.css"/>
  <resource type="download" name="myConfluenceMacro.js" location="/js/myConfluenceMacro.js"/>
  <resource type="download" name="images/" location="/images"/>

  <context>myConfluenceMacro</context>
</web-resource>

<xhtml-macro name="helloworld" class="com.atlassian.tutorial.macro.helloworld" key='helloworld-macro' hidden="false">
  <description key="helloworld.macro.desc"/>
  <category name="formatting"/>
  <parameters />
</xhtml-macro>

```

Maybe the instruction "Locate the end of the \<web-resource\>...\</web-resource\> section in the file and enter the following:" should be updated to say "Locate the end of the \<web-resource\>...\</web-resource\> section in the file and enter the following after the closing web-resource tag"?

Hopefully this helps others going forward!

comments: author: Ocean MIH
body: great answer, save me time.


author: belteshazzar
body: rrr, did exactly the same thing ...


author: Dominic Lagger
body: Thanks a lot!

It saved me the evaning! I was desperate.!


author: harshahid_h
body: [@Matt Leary](/t5/user/viewprofilepage/user-id/331688) Matt Leary Thanks a lot !!! :)


author: Matt Flaherty
body: Same problem here three years later. Tutorial is very unclear:

"Locate the end of the \<web-resource\>...\</web-resource\> section in the file and enter the following:"

How about "Locate the end of the \<web-resource\>...\</web-resource\> section in the file and insert the following after:"

or even...

"Locate the \</atlassian-plugin\> end tag and insert the following just before it:"


author: Brock Price
body: Same problem here. But also having problems, in general, getting the macro to appear.


author: serge alex
body: it's the bad you haven't change that in the tutorial and all newcomer gat the same f\*\* problem with in (((


Tags: atlassian-sdk

developer

developer-documentation

helloworld

macro

macro-browser