5 thing you're not doing, 4 things you should stop doing & 3 things you should keep doing...

26
Getting Started with Plugin Development 1 Matt Ryall Confluence Technical Lead, Atlassian Atlassian Summit 2010 1 Monday, June 14, 2010

Upload: atlassian

Post on 17-May-2015

2.380 views

Category:

Technology


4 download

DESCRIPTION

5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin Matt Ryall, Atlassian

TRANSCRIPT

Page 1: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

Getting Started with Plugin Development

1

Matt RyallConfluence Technical Lead, Atlassian

Atlassian Summit 2010

1Monday, June 14, 2010

Page 2: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

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

Page 3: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

Little-Known Fact #1:Plugins don’t need to be written in Java.

33Monday, June 14, 2010

Page 4: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

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

Page 5: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

Use web technologies instead

‣ HTML

‣ CSS

‣ JavaScript (with jQuery)

55Monday, June 14, 2010

Page 6: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

Little-Known Fact #2:Plugins don’t need to be distributed in a JAR file.

66Monday, June 14, 2010

Page 7: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

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

Page 8: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

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

Page 9: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

Little-Known Fact #3:You don’t need to know Java to create a JAR file.

99Monday, June 14, 2010

Page 10: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

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

Page 11: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

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

Page 12: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

Great! Let’s see how it works…

1212Monday, June 14, 2010

Page 13: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

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

Page 14: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

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

Page 15: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

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

Page 16: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

Last Step: Upload it into Confluence

1616Monday, June 14, 2010

Page 17: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

Result: Link to your Company Intranet

17

‣ Holy smokes, that was easy!

17Monday, June 14, 2010

Page 18: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

Example: Project Status User Macro

1818Monday, June 14, 2010

Page 19: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

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

Page 20: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

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

Page 21: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

Last Step: Upload it into Confluence

2121Monday, June 14, 2010

Page 22: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

Result: Project Status User Macro

2222Monday, June 14, 2010

Page 23: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

More examples

23

Devoxx Conference Twitter Ticker – JavaScript User Macro

23Monday, June 14, 2010

Page 24: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

More examples

24

Atlassian’s Staff Directory – just HTML, CSS and JavaScript

24Monday, June 14, 2010

Page 25: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

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

Page 26: 5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

Thank you.

2626Monday, June 14, 2010