Create HelloWorld plugin project

en:https://developer.atlassian.com/server/framework/atlassian-sdk/create-a-helloworld-plugin-project/

Now that you have a local development environment configured for the Atlassian SDK, you will create your first Atlassian server plugin.

Important: This guide describes how to build a plugin for the Atlassian server. If you want to develop an application for the Atlassian cloud, please see the JIRA Cloud Getting Started guide .

This plugin will be very simple, but you will learn the basic steps to create a plugin and start your application environment.

If you get stuck, you can compare your program with our source code. This idea is based on the Atlassian Plugin SDK 6.2.9 test run.

Step 1. Build a plugin framework using the Atlassian SDK

  1. Go into the directory on your system where you want to create your plugin, the command we're about to run will create a folder containing the plugin directory.

  2. Create a plugin project with the name atlas-create-jira-plugin in the command line window:

    atlas-create-jira-plugin

    This naming is for building a plugin framework using maven. Some log messages appear on the screen showing the maven command line being executed, and the version of JIRA being used.

  3. You will be prompted to provide some information about your plugin. In this example, enter the following:

    Define value for groupId: : com.atlassian.tutorial
    Define value for artifactId: : myPlugin
    Define value for version: 1.0.0-SNAPSHOT: : 1.0.0-SNAPSHOT
    Define value for package: com.atlassian.tutorial: : com.atlassian.tutorial.myPlugin
  4. You will then be prompted to confirm your configuration information. Check the details to make sure they are correct, then enter Y to continue.

    Confirm properties configuration:
    groupId: com.atlassian.tutorial
    artifactId: myPlugin
    version: 1.0.0-SNAPSHOT
    package: com.atlassian.tutorial.myPlugin
    And: : And

    The base framework for your Atlassian JIRA plugin is created in the myPlugin directory.

    .
    ├── LICENSE
    ├── README
    Pom── pom.xml
    └── src
        ├── main
        │   ├── java
        │ │ └── with
        │   │       └── atlassian
        │   │           └── tutorial
        │   │               └── myPlugin
        │   │                   ├── api
        │   │                   │   └── MyPluginComponent.java
        │   │                   └── impl
        │   │                       └── MyPluginComponentImpl.java
        │   └── resources
        │ ├── META-INF
        │       │   └── spring
        │       │       └── plugin-context.xml
        │       ├── atlassian-plugin.xml
        │       ├── css
        │       │   └── myPlugin.css
        │       ├── images
        │       │   ├── pluginIcon.png
        │       │   └── pluginLogo.png
        │       ├── myPlugin.properties
        │       └── js
        │           └── myPlugin.js
        └── test
            ├── java
            │   ├── it
            │ │ └── with
            │   │       └── atlassian
            │   │           └── tutorial
            │   │               └── myPlugin
            │   │                   └── MyComponentWiredTest.java
            └── └── ut
            │ └── with
            │           └── atlassian
            │               └── tutorial
            │                   └── myPlugin
            │                       └── MyComponentUnitTest.java
            └── resources
                └── atlassian-plugin.xml

    Before continuing, take a moment to browse through the different files created by the Atlassian SDK.

Step 2. Start JIRA with the plugin installed

In this step, we will use the atlas-run command line to run the application (JIRA in this case) and install the plugin. Then make sure that JIRA has started and installed the plugin created in the first step.

  1. Change to the myPlugin directory and enter the following command:

    atlas-run

    This will use the information from the plugin framework you created earlier to download JIRA, along with everything else needed by the plugin itself, and then launch JIRA with your plugin installed.

    The first execution may take a few minutes to complete.

    Once JIRA has started, we will see the following message in the command line window:

    [INFO] [talledLocalContainer] Aug 08, 2016 5:51:33 PM org.apache.catalina.startup.Catalina start
    [INFO] [talledLocalContainer] INFO: Server startup in 234207 ms
    [INFO] [talledLocalContainer] Tomcat 8.x started on port [2990]
    [INFO] jira started successfully in 332s at http://DESKTOP-EF2CA9N:2990/jira
    [INFO] Type Ctrl-D to shutdown gracefully
    [INFO] Type Ctrl-C to exit
  2. Open a browser window and navigate to localhost:2990/jira . Log in with the following identity information:

    Username : admin
    Password : admin
  3. A welcome dialog will appear and let you configure some basic JIRA settings.

    You only need to do these things once, and the settings will be remembered the next time you use the atlas-run command.

  4. Type gg, then type manage. Select Manage Add-ons from the list that appears.
    (Other than that, you can click the gear icon to open the admin dialog, then select Add-ons, and finally when the Atlassian MarketPlace admin page opens, select Manage add-ons on the right.)

  5. Open the list of myPlugins in User-installed add-ons and click on them to expand.

  6. You see one of the lists is the plugin itself, and the other is the plugin tests. Note that plugins have some base modules created by the SDK.

  7. Close the browser and go back to the command line window where JIRA is running.

  8. Close JIRA gracefully with CTRL+D (on OSX and Linux) or CTRL+Z (on Windows).

Next step

You already have a basic plugin framework, so let's learn how to modify and customize it to provide a menu on JIRA. 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325213159&siteId=291194637