5 thing you're not doing, 4 things you should stop doing & 3 things you should keep doing...
DESCRIPTION
5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin Matt Ryall, AtlassianTRANSCRIPT
Getting Started with Plugin Development
1
Matt RyallConfluence Technical Lead, Atlassian
Atlassian Summit 2010
1Monday, June 14, 2010
Why have you never developed a plugin?
‣ Don’t know how
‣ Not a Java programmer
‣ Too hard
‣ Too much initial set-up
‣ Don’t know the product APIs
22Monday, June 14, 2010
Little-Known Fact #1:Plugins don’t need to be written in Java.
33Monday, June 14, 2010
Plugins types that don’t use Java
‣ Web Items – Add custom links to your application
‣ Web Panels – Add additional content on the page
‣ Web Resources – Restyle or customise the page with CSS and JavaScript
‣ External Gadget Providers or Gadget Plugins – Custom Google gadgets
‣ Confluence User Macros – Create simple Confluence macros
44Monday, June 14, 2010
Use web technologies instead
‣ HTML
‣ CSS
‣ JavaScript (with jQuery)
55Monday, June 14, 2010
Little-Known Fact #2:Plugins don’t need to be distributed in a JAR file.
66Monday, June 14, 2010
Upload plugins directly
‣ If there’s no other files, just upload the XML descriptor file.
‣ This works for:• Web Items
• Web Panels
• Web Resources (sometimes)
• Confluence User Macros
‣ External Gadget Providers can be installed via URL
77Monday, June 14, 2010
XML file template
8
<atlassian-plugin key="com.example.plugins.sample" name="My Sample Plugin" plugins-version="2"> <plugin-info> <version>1.0</version> <vendor>My Company</vendor> </plugin-info>
... your stuff goes here ...
</atlassian-plugin>
http://confluence.atlassian.com/display/CONFDEV/Creating+your+Plugin+Descriptor
8Monday, June 14, 2010
Little-Known Fact #3:You don’t need to know Java to create a JAR file.
99Monday, June 14, 2010
Use the plugin SDK
‣ First, create the plugin skeleton:• Run atlas-create-confluence-plugin and it will prompt for values
‣ Delete the src/main/java and src/test directories
‣ Put CSS, JS files in the src/main/resources directory
‣ Build a JAR with your files• Run atlas-package and it will build a new JAR file in the target/ directory
1010Monday, June 14, 2010
Plugin structure with no Java code
11
‣ POM includes instructions for SDK
‣ Plugin content is under src/main/resources/
‣ Run atlas-package and the plugin JAR appears in target/ directory
11Monday, June 14, 2010
Great! Let’s see how it works…
1212Monday, June 14, 2010
Example: Link to your Company Intranet
13
http://confluence.atlassian.com/display/CONFDEV/Web+UI+Module
‣ Adding a link to Confluence’s global Browse menu• Also works in other places
• Also works in other Atlassian applications
‣ Done in only 2½ steps
13Monday, June 14, 2010
Step 1: Create a Web Item
14
http://confluence.atlassian.com/display/CONFDEV/Web+UI+Module
<web-item key="company-intranet" name="Company Intranet" section="system.browse/global" weight="40"> <label>My Company Intranet</label> <link>http://intranet.example.com/</link></web-item>
14Monday, June 14, 2010
Step 2: Drop it in the XML template
15
<atlassian-plugin key="com.example.plugins.sample" name="My Sample Plugin" plugins-version="2"> <plugin-info> <version>1.0</version> <vendor>My Company</vendor> </plugin-info>
<web-item key="company-intranet" name="Company Intranet" section="system.browse/global" weight="40"> <label>My Company Intranet</label> <link>http://intranet.example.com/</link> </web-item>
</atlassian-plugin>
15Monday, June 14, 2010
Last Step: Upload it into Confluence
1616Monday, June 14, 2010
Result: Link to your Company Intranet
17
‣ Holy smokes, that was easy!
17Monday, June 14, 2010
Example: Project Status User Macro
1818Monday, June 14, 2010
Step 1: Create your User Macro
19
<user-macro key="green" name="green" hasBody="false" bodyType="raw" outputType="html"> <template><![CDATA[ <span style="background: green; color: white; padding: 4px 12px">GREEN</span> ]]></template></user-macro>
http://confluence.atlassian.com/display/CONFDEV/User+Macro+Module
‣ You might also want to create ones for {red} and {yellow}…
19Monday, June 14, 2010
Step 2: Drop it in the XML template
20
<atlassian-plugin key="com.example.plugins.sample" name="My Sample Plugin" plugins-version="2"> <plugin-info> <version>1.0</version> <vendor>My Company</vendor> </plugin-info>
<user-macro key="green" name="green" hasBody="false" bodyType="raw" outputType="html"> <template><![CDATA[ <span style="background: green; color: white; padding: 4px 12px">GREEN</span> ]]></template> </user-macro>
</atlassian-plugin>
20Monday, June 14, 2010
Last Step: Upload it into Confluence
2121Monday, June 14, 2010
Result: Project Status User Macro
2222Monday, June 14, 2010
More examples
23
Devoxx Conference Twitter Ticker – JavaScript User Macro
23Monday, June 14, 2010
More examples
24
Atlassian’s Staff Directory – just HTML, CSS and JavaScript
24Monday, June 14, 2010
Scripting support (alpha stage)
‣ Scripting Extender Plugin – Adds support for scripting languages in your plugin
‣ Groovy Plugins – Lightning talk coming up next…
‣ JavaScript Plugins – At prototype stage, might be bundled soon.
‣ Java 6 Scripting Engine – Can use this with some Java code.
‣ Area of interest for some Atlassian developers – 20% projects and labs work ongoing.
2525Monday, June 14, 2010
Thank you.
2626Monday, June 14, 2010