Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

No Macro Metadata when editing a Macro in editor

Stefan Kohler
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 3, 2012

I'm building a new plugin for Confluence 4 and therefor using my first xhtml-macro ;-)
I already added a parameter to the definition in the atlassian-plugin.xml

<category name="external-content"/>
<parameters>
  <parameter name="status" type="enum" default="Open">
    <value name="Draft"/>
    <value name="Open"/>
    <value name="Accepted"/>
  </parameter>
</parameters>

When I add the macro using the Macro Browser I get the option to select the status before adding it to my page.
If I try to edit the macro the Macro Browser shows me the message "No Macro Metadata", "There is no metadata configured for this macro which means no configuration screen can be presented here."

I thought adding the parameters to the XML would be sufficient for the Macro Browser/Editor.. isn't it?

Added 2 images, 1st is when adding the macro to the page.. 2nd is when I try to edit the Macro

Inserting Macro Editing the Macro

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

14 votes
Answer accepted
Stefan Kohler
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 19, 2012

I have found the reason why it didn't work!

In my atlassian-plugin.xml I had the following

<xhtml-macro key="freshbooks-estimates" name="FreshBooks Estimates" class="nl.stefankohler.confluence.FreshBooksEstimatesMacro">

And that got me the above error.. Comparing it with the example Sam provided I changed the line to

<xhtml-macro key="freshbooks-estimates" name="freshBooks-estimates" class="nl.stefankohler.confluence.FreshBooksEstimatesMacro">

I made the difference bold, otherwise you might not see it ;-)
But that did the trick, for some reason an name with spaces in it is not allowed, which is not inline with the documentation or other components.. Maybe a bug?

My issue is resolved, thanks for all the effort!

Ramesh Lakshmanasamy December 20, 2017

its working for me .Thanks

6 votes
AdrienA June 16, 2012

I've tried it. The name="SomeName" seems to be the issue:

  • Upper-case first letter would reproduce the issue,
  • Upper-case in any other letter would reproduce the issue,
  • Hyphen (-) would work perfectly,
  • Space would work perfectly (surprisingly)

I would suggest using combinations of lowercase letters and hyphens only.

tousifs
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 9, 2012

Thanks,

its a trick rather than technical problem it work for me.

Ramesh Lakshmanasamy December 20, 2017

yes Correct My issue is resolved, When we use macro key and name both must be lowercase(all letters)

1 vote
Samuel Le Berrigaud
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 19, 2012

I've given a simple XHTML macro a try to check whether I could reproduce here are the 3 files I have, everything works fine.

The DemoMacro.java:

package xhtml.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 final class DemoMacro implements Macro
{
    @Override
    public String execute(Map<String, String> stringStringMap, String s, ConversionContext conversionContext) throws MacroExecutionException
    {
        return "It works!";
    }

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

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

The plugin descriptor (atlassian-plugin.xml):

<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2">
    <plugin-info>
        <description>${project.description}</description>
        <version>${project.version}</version>
        <vendor name="${project.organization.name}" url="${project.organization.url}"/>
    </plugin-info>

    <xhtml-macro name="xhtml-macro-demo" class="xhtml.macro.DemoMacro" key="xhtml-macro-demo">
        <category name="development"/>
        <parameters>
            <parameter name="status" type="enum" default="Open">
                <value name="Draft"/>
                <value name="Open"/>
                <value name="Accepted"/>
            </parameter>
        </parameters>
    </xhtml-macro>
</atlassian-plugin>

And the pom.xml:

<?xml version="1.0" encoding="UTF-8"?>

<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>xhtml-macro</groupId>
    <artifactId>xhtml-macro</artifactId>
    <version>1.0-SNAPSHOT</version>

    <organization>
        <name>Example Company</name>
        <url>http://www.example.com/</url>
    </organization>

    <name>xhtml-macro</name>
    <description>This is the xhtml-macro:xhtml-macro plugin for Atlassian Confluence.</description>
    <packaging>atlassian-plugin</packaging>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.6</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence</artifactId>
            <version>${confluence.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.plugin</groupId>
            <artifactId>func-test</artifactId>
            <version>2.3</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.sourceforge.jwebunit</groupId>
            <artifactId>jwebunit-htmlunit-plugin</artifactId>
            <version>2.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.sourceforge.nekohtml</groupId>
            <artifactId>nekohtml</artifactId>
            <version>1.9.12</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-confluence-plugin</artifactId>
                <version>3.7</version>
                <extensions>true</extensions>
                <configuration>
                    <productVersion>${confluence.version}</productVersion>
                    <productDataVersion>${confluence.data.version}</productDataVersion>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <properties>
        <confluence.version>4.0</confluence.version>
        <confluence.data.version>3.5</confluence.data.version>
        <amps.version>3.7</amps.version>
    </properties>

</project>

Hopefully that helps you sort things out. Let me know how you go…

0 votes
LuziaL
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 3, 2012

Hi Stefan,

A few links that may help you to verify/confirm you're doing everything right:

http://confluence.atlassian.com/display/DOC/Guide+to+User+Macro+Templates

http://confluence.atlassian.com/display/DOC/Writing+User+Macros

http://confluence.atlassian.com/display/DOC/Examples+of+User+Macros

Now, we also have this bug (https://jira.atlassian.com/browse/CONF-24254) we had another customer with the same symptom you're talking about and that was being caused by this bug. BUT, it could be something else for you.

Would you open a support issue at support.atlassian.com under Confluence project so we can take a closer look?

Thanks!

Best regards,
Luzia Mendes
Atlassian Support
Tweet us! #atlassiansupport
Have a Question? Get Answers on http://answers.atlassian.com

Stefan Kohler
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 18, 2012

Unfortunaly still having issues with the macro editor, I created an issue in the support JIRA https://support.atlassian.com/browse/CSP-75138. Hopefully it's just a minor mistake I made somewhere ;-)

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events