configuring eclipse for debugging jira plugins

88
Configuring Eclipse for Debugging JIRA Plug-ins

Upload: jrgalang

Post on 12-Nov-2014

2.692 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 2: Configuring Eclipse for Debugging JIRA Plugins
Page 3: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 3 of 88

INTRODUCTION

The following document details the step-by-step installation of the

necessary applications required to configure a developer’s workstation

so as to be able to develop, deploy, and debug plug-ins for JIRA.

The setup briefs the developer with the required files, settings, and

development environment through step-by-step screenshots of each

process and contains brief explanations of each step whenever needed.

Most of the software downloaded in this document is the latest version

on the date it was written. Feel free to contact author if ever the

content contained herein already are out-of-date or if some descriptions

are insufficient.

Configuring Eclipse for Debugging JIRA Plug-ins by Macquarie Group

Ltd. is licensed under a Creative Commons Attribution – No Derivative

Works 3.0 Philippines License.

Page 4: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 4 of 88

TABLE OF CONTENTS

I. Configuring the Java Development Kit (JDK)..............................................................5

A. Downloading the JDK .........................................................................................5

B. JDK Installation ....................................................................................................8

C. Configuring Environment Variables for Java ..........................................16

D. Testing the JDK Installation ..........................................................................21

II. Configuring Eclipse IDE for Java EE Developers ....................................................23

A. Downloading and Installing Eclipse IDE ...................................................23

B. Running Eclipse for the First Time..............................................................31

C. Configure Network Settings for Eclipse ....................................................32

III. Configuring Maven 2 ........................................................................................................34

A. Maven 2 Standalone Edition..........................................................................34

B. Configuring Environment Variables for Maven 2 ..................................40

C. Configuring Maven 2’s Settings ...................................................................45

D. Testing Maven 2 Installation ........................................................................51

E. Maven 2 Plug-in for Eclipse ...........................................................................52

IV. Configuring JIRA in a Local Machine ..........................................................................58

A. Downloading JIRA Enterprise Edition ........................................................58

B. Setup JIRA Enterprise Edition.......................................................................60

C. Testing JIRA Enterprise Edition Installation............................................69

V. Creating a Simple “Hello World” JIRA Plug-in ..........................................................71

A. Sample Project Requirements ......................................................................71

B. Importing the Sample Project to Eclipse..................................................73

C. Creating a Run Configuration for the Sample Project.........................80

D. Packaging the Sample Project to a JAR file ............................................85

E. Breakpoint lines from the Sample Project ...............................................86

F. Remotely debug the Sample Project..........................................................87

Page 5: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 5 of 88

I. Configuring the Java Development Kit (JDK)

A. Downloading the JDK

The configuration of your workstation begins with downloading the Java Development Kit (JDK). The JDK is required to compile most of your

Java Applications.

Visit the following URL to download your copy:

http://java.sun.com/javase/downloads/index.jsp

The following page will appear:

Click on the DOWNLOAD button located on the Java SE Development Kit (JDK) as displayed in the image.

Page 6: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 6 of 88

The following page will display, simply select WINDOWS in the platform choices and check the box to agree to the JDK’s License Agreement

then click CONTINUE.

Should the following appear in your browser, simply click YES as shown

in the following figure:

Page 7: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 7 of 88

Click on the hyperlink as shown below and download should begin:

A download dialog box will appear, simply click RUN as shown below:

Page 8: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 8 of 88

B. JDK Installation

When the download completes, a Security Warning dialog box will

appear, simply click RUN as shown in the following:

The JDK installer will load and display its license agreement, simply

click ACCEPT to proceed with the installation:

Page 9: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 9 of 88

To avoid having problems with other JAVA-based programs from being

unable to detect a valid JAVA installation in your system, it is highly recommended to change the installation directory to the root of your

C:\ drive. So click change on the following page as shown in the following figure:

Page 10: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 10 of 88

After clicking the change button, the following window should appear:

Change the FOLDER NAME with the exact value as shown in the figure

and click OK.

You will then be redirected to the previous page wherein you will have to press NEXT to proceed with the installation of the JDK.

Page 11: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 11 of 88

The installation of the JDK will then begin with the progress of the

installation process displayed in the following page:

Page 12: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 12 of 88

This installer version is bundled with the latest version of the JAVA

Runtime Environment (JRE). The JRE allows the developer to run Java-built applications in their workstations. Given that the JRE is bundled

onto the installer, its corresponding setup page will appear:

Page 13: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 13 of 88

Similar to the JDK, it is recommended that the default JRE installation

folder be changed. Thus, in the figure shown above, click the CHANGE button and the following should appear:

You will then be redirected to the previous page wherein you will have

to press NEXT to proceed with the installation of the JRE.

Page 14: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 14 of 88

The installation of the JRE will then begin with the progress of the

installation process displayed on the following page:

The JRE’s installation window will automatically close after installation

and the entire Java installation will resume.

Page 15: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 15 of 88

Once installation is done, the JAVA setup file will notify you by

displaying:

Simply click FINISH on this page and you should’ve successfully

installed Java.

A registration page may appear in your browser after installation. You may either ignore this and close your browser or register to Sun to

receive updates on Java and its related technologies.

Page 16: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 16 of 88

C. Configuring Environment Variables for Java

After installing JAVA, it is recommended to set its installation directory

into Windows’ Environment Variables. To do so, right-click the MY COMPUTER ICON on your Desktop (or in your START menu) and click

PROPERTIES as shown in the following figures:

Figure right-clicking on the My Computer Icon via the Desktop

Figure right-clicking on the My Computer Icon via the Start Menu

Page 17: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 17 of 88

The System Properties page will appear, similar to the following figure:

Click Advanced as shown in the figure to load the Advanced page.

Page 18: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 18 of 88

Click Environment Variables on the page as shown in the following

figure:

The Environment Variables page should appear.

Page 19: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 19 of 88

In the Environment Variables page, under the SYSTEM VARIABLES list,

click the NEW button as shown in the following figure:

In the new page, enter the following values:

Page 20: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 20 of 88

Return to the Environment Variables page and look for the PATH

variable. Select it and click on EDIT as shown in the following figure:

At the last of the PATH values, make sure there is a semi-colon “;”

symbol at the end of the last value and enter the following value:

%JAVA_HOME%\bin;

As shown in this figure:

Page 21: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 21 of 88

D. Testing the JDK Installation

To test whether the JAVA installation is correct, it is advisable to open a COMMAND PROMPT, which can be accessed by pressing the WINDOWS

KEY + R shortcut and typing “cmd” in the RUN WINDOW or by opening it in the ALL PROGRAMS>ACCESSORIES section of your START MENU.

Figure showing COMMAND PROMPT access via the RUN shortcut key.

Figure showing COMMAND PROMPT access via START MENU.

Page 22: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 22 of 88

When the COMMAND PROMPT appears, type the following commands:

java –version

and

javac –version

If the installation of Java is correct, the system will respond to both

commands and display the version of Java installed and the version of its compiler, as shown in the figure below:

Page 23: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 23 of 88

II. Configuring Eclipse IDE for Java EE Developers

A. Downloading and Installing Eclipse IDE

As per current writing, JIRA only supports two Development Environments for building it from source and creating plugins: IDEA and

Eclipse. In this document, Eclipse will be used.

Visit the following URL to download a copy of Eclipse SR2:

http://www.eclipse.org/ganymede

The following page will appear:

Click on DOWNLOAD GANYMEDE to go to the download page.

Page 24: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 24 of 88

On the following page, look for ECLIPSE IDE FOR JAVA EE DEVELOPERS

and click the WINDOWS link beside it, as shown in the following figure:

The webpage will then locate your IP address and select the proxy server closest to your location.

Page 25: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 25 of 88

In the following page, simply select the mirror chosen by the site as

shown in the following figure:

In the given example, the chose mirror is [Australia] Pacific Internet

(http). It is possible that this may change, but clicking this will also result in your browser loading a Download Dialog Box.

Page 26: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 26 of 88

When the download dialog box appears, similar to download JAVA,

simply click OPEN as shown in the following:

When the download finishes, Windows’ built-in archive loader opens the

file or any other package loader installed in the system. Extract the files contained in the .zip file by clicking EXTRACT ALL as shown in the

following image:

Page 27: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 27 of 88

The Extraction Wizard will appear, click NEXT similar to the following:

In the next window, in the FILES WILL BE EXTRACTED IN THIS

DIRECTORY, change the path to:

C:\

As shown in the following image:

Page 28: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 28 of 88

After extraction, similar to opening the COMMAND PROMPT, press the

WINDOWS KEY + R button to open the RUN window and enter:

C:\eclipse

As shown in the following figure:

After accessing the “eclipse” folder, the installation of the IDE begins by simply opening the eclipse.exe file as shown in the following:

Page 29: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 29 of 88

Should security warnings appear after opening the .exe file, simply click

YES as shown below:

Page 30: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 30 of 88

Eclipse’s splash screen will appear similar to this image:

Shortly after the splash screen, the WORKSPACE LAUNCHER will

appear, enter the following values in the workspace field:

C:\Documents and Settings\[USERDIR]\workspace

Where [USERDIR] is the folder of the user account you are currently using (normally contains the first letter of your first name added with

your surname using your Macquarie Workstation) and click OK as shown in the following figure:

Page 31: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 31 of 88

B. Running Eclipse for the First Time

After selecting your workspace, Eclipse will load with its default

welcome page. Click on the WORKBENCH icon as shown below:

The workbench displays the main window of your Eclipse IDE. It gives information of projects loaded onto your workspace, the problems list,

and switch features that changes the arrangements and content of the workbench to make it more suitable for the task that the developer is

currently working on.

Page 32: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 32 of 88

C. Configure Network Settings for Eclipse

Once the Workbench loads, the first thing to do is to allow Eclipse to connect to the internet via Macquarie’s proxy configuration. To do so,

click on the WINDOW pane in the menu bar of Eclipse and select Preferences as shown in the figure below:

Page 33: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 33 of 88

In the Preferences page, expand the GENERAL list and select NETWORK

CONNECTIONS. Follow the settings listed below:

Manual proxy configuration:

HTTP proxy: proxy-hk3.macbank Port: 8080

Enable proxy authentication: Checked

Username: NTADMIN\USERNAME Password: PASSWORD

Values “USERNAME” and “PASSWORD” is your Macquarie Workstation’s

login credentials. Click Apply after entering the settings and click OK.

Eclipse should now be able to download and retrieve information over the internet, which is an important factor in the next chapter.

Page 34: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 34 of 88

III. Configuring Maven 2

A. Maven 2 Standalone Edition

Maven 2 can be used in two forms: one (1) as a standalone version that can be used via the workstation’s Command Prompt, and two (2) as a

plug-in for Eclipse. The latter will be discussed later on, as both versions are recommended to be installed in the case that connection

time outs occur in either the plug-in version or in the standalone

version and other problems that may hinder your JIRA plug-in project from being packaged into a compatible format readable by JIRA itself.

Visit the following URL to download your copy:

http://maven.apache.org/download.html

The following page will appear:

Page 35: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 35 of 88

Download the latest version of Maven 2’s source zip by clicking the

Mirrors link beside it as shown in the figure.

After clicking the mirror link, a Download Mirrors page will appear, select any of the HTTP or FTP links containing the file to begin

download, as shown in the figure below:

Page 36: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 36 of 88

A File Download page will appear, similar to the JDK download, simply

click OPEN as shown in the following figure:

When the file download is complete, click the EXTRACT ALL FILES button as shown below:

Page 37: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 37 of 88

An Extraction Wizard will appear, simply click next on its main page as

shown in the following figure:

On the following page, change the directory to the following:

C:\

As shown in the following figure:

Page 38: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 38 of 88

When the extract process is completed, check SHOW EXTRACTED FILES

and click on FINISH as shown in the following figure:

If left uncheck, the directory can still be accessed by pressing

WINDOWS KEY + R to open a RUN Window and enter the following:

C:\

As shown in the following figure:

Page 39: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 39 of 88

Find the apache-maven-2.2.0 folder, right-click it and select RENAME

as shown in the following:

Change the name of the folder to:

maven2

And press ENTER.

Page 40: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 40 of 88

B. Configuring Environment Variables for Maven 2

Setting Environment Variables for Maven 2 is nearly the same as

setting it in JAVA. To do so, right-click the MY COMPUTER ICON on your Desktop (or in your START menu) and click PROPERTIES as shown in

the following figures:

Figure right-clicking on the My Computer Icon via the Desktop

Figure right-clicking on the My Computer Icon via the Start Menu

Page 41: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 41 of 88

The System Properties page will appear, similar to the following figure:

Click Advanced as shown in the figure to load the Advanced page.

Page 42: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 42 of 88

Click Environment Variables on the page as shown in the following

figure:

The Environment Variables page should appear.

Page 43: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 43 of 88

In the Environment Variables page, under the SYSTEM VARIABLES list,

click the NEW button as shown in the following figure:

In the new page, enter the following values:

Page 44: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 44 of 88

Return to the Environment Variables page and look for the PATH

variable. Select it and click on EDIT as shown in the following figure:

At the last of the PATH values, make sure there is a semi-colon “;”

symbol at the end of the last value and enter the following value:

%M2_HOME%\bin;

As shown in this figure:

Page 45: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 45 of 88

C. Configuring Maven 2’s Settings

Maven 2, both standalone version and plug-in version, relies on a

settings.xml file to connect to its repositories and download the required files to compile your projects depending on the goals you set

for it. To create this settings.xml file, simply open Notepad in your computer, wherein the shortcut will be pressing the WINDOWS KEY +

R again and load the Run window and enter the following:

notepad.exe

As shown in the following figure:

\

Notepad will open similar to the following:

Page 46: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 46 of 88

Insert the following codes into the empty notepad file:

<settings>

<proxies> <proxy>

<active>true</active> <protocol>http</protocol>

<host>proxy-hk3.macbank</host> <port>8080</port>

<username>NTADMIN/rgalang</username> <password>d3c3g4l4</password>

<nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts

> </proxy>

</proxies>

<servers> <server>

<id>atlassian-contrib</id> <username>yourusername</username>

<password>yourpassword</password> </server>

<server> <id>atlassian-contrib-snapshot</id>

<username>yourusername</username> <password>yourpassword</password>

</server> </servers>

<profiles> <profile>

<id>jnolen-devnet-profile</id>

<activation> <activeByDefault>true</activeByDefault>

</activation> <repositories>

<repository> <id>atlassian-public</id>

Page 47: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 47 of 88

<url>https://maven.atlassian.com/repository/public</url>

<snapshots> <enabled>true</enabled>

</snapshots> <releases>

<enabled>true</enabled> </releases>

</repository> <repository>

<id>atlassian-m1-repository</id>

<url>https://maven.atlassian.com/maven1</url> <layout>legacy</layout>

</repository> </repositories>

<pluginRepositories>

<pluginRepository> <id>atlassian-public</id>

<url>https://maven.atlassian.com/repository/public</url>

<snapshots> <enabled>true</enabled>

</snapshots> <releases>

<enabled>true</enabled> </releases>

</pluginRepository> </pluginRepositories>

<properties> <downloadSources>true</downloadSources>

<downloadJavadocs>true</downloadJavadocs>

<atlassian.pdk.server.url>http://localhost:1990/confluence/</atlassian.pdk.server.url>

<atlassian.pdk.server.username>admin</atlassian.pdk.server.usernam

e>

<atlassian.pdk.server.password>admin</atlassian.pdk.server.password>

</properties> </profile>

</profiles> </settings>

Page 48: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 48 of 88

Click FILE and select SAVE, similar to the following:

A SAVE AS dialog box will appear, enter the following details:

File name: settings.xml

Save as type: All Files Encoding: ANSI

As shown in the following:

Page 49: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 49 of 88

After saving the settings.xml file, open the RUN WINDOW again by

pressing WINDOWS KEY + R and open a Command Prompt by entering the following:

cmd

As shown in the following illustration:

Once the Command Prompt loads, enter the following value:

mkdir “C:\Documents and Settings\[USERNAME]\.m2”

As shown in the following:

Where [USERNAME] is the username of the account you use to login to

your workstation.

Page 50: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 50 of 88

Once done, open another RUN WINDOW by pressing WINDOWS KEY

+ R and type the following value:

C:\Documents and Settings\[USERNAME]\.m2

Copy your created settings.xml into this folder as shown in the following figure:

Page 51: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 51 of 88

D. Testing Maven 2 Installation

To test if your Maven 2 Standalone Version works, open a Command

Prompt by pressing WINDOWS KEY + R and enter the following:

cmd

As shown in the following illustration:

Once the Command Prompt loads, enter the following value:

mvn --version

If the installation is correct, the command will display the following:

Page 52: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 52 of 88

E. Maven 2 Plug-in for Eclipse

Maven 2 can be used within the Eclipse IDE as well, to do this, simply

open Eclipse and click HELP on the menu bar and select SOFTWARE UPDATES as shown in the following:

The Software Updates and Add-Ons Page will appear.

Page 53: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 53 of 88

In the Software Updates and Add-Ons Page, click on AVAILABLE

SOFTWARE and select ADD SITE as shown in the following:

In the ADD SITE dialog box, enter the following as the Location:

http://m2eclipse.sonatype.org/update/

The location will then be added to your list of AVAILABLE SOFTWARE.

Page 54: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 54 of 88

Expand the list after and make sure that the following are the only ones

checked:

Click INSTALL after and an install summary will appear similar to the

following:

Simply click NEXT and proceed to the next page.

Page 55: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 55 of 88

A License Review Page will appear, simply agree to the license similar

to the figure below and click on FINISH to begin the installation of the plug-in:

An install progress bar will appear, similar to this:

Page 56: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 56 of 88

Eclipse IDE will advise you to restart the platform for the plug-in

changes to take effect, simply click YES and Eclipse will restart after, similar to the following:

Upon restart, Eclipse IDE’s welcome page may have changed to the following:

Click the WORKBENCH icon as marked on the image above.

Page 57: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 57 of 88

The plug-in of Maven 2 in Eclipse as of current writing, has bugs

detecting the system’s JDK and refers to a JRE instead. If this case happens, simply open a RUN WINDOW by pressing the WINDOWS

KEY + R and enter the following:

C:\eclipse\eclipse.ini

As shown in the following figure:

A text file will open containing start-up parameters for Eclipse, delete

all its contents and change it to the following:

-showsplash org.eclipse.platform

--launcher.XXMaxPermSize

256m -vm

C:\Java\jdk1.6.0_10\bin\javaw.exe -framework

plugins\org.eclipse.osgi_3.4.3.R34x_v20081215-1030.jar -vmargs

-Dosgi.requiredJavaVersion=1.5 -Xms256m

-Xmx512m

This should optimize Eclipse and at the same time force it to use the JDK that has been installed early on.

Page 58: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 58 of 88

IV. Configuring JIRA in a Local Machine

A. Downloading JIRA Enterprise Edition

JIRA is a Bug Tracking and Issue Tracking Software created by Atlassian.

Visit the following URL to download your copy:

http://www.atlassian.com/software/jira/JIRADownloadCenter.jspa

The following page will appear:

Click on the DOWNLOAD button for JIRA 3.13.5 Enterprise – Standalone

(Windows Installer)

Page 59: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 59 of 88

The page will redirect to the download page and a Download Box will

pop-up shortly as shown in this figure:

Page 60: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 60 of 88

B. Setup JIRA Enterprise Edition

As with the previous cases, simply press RUN in the Security Warning:

Click RUN as well in the next security warning:

Page 61: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 61 of 88

Simply click NEXT in the first page of the setup:

JIRA will ask for the destination directory – you may leave this intact and just click NEXT:

Page 62: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 62 of 88

Click NEXT as well in the following page:

Leave INSTALL JIRA AS A SERVICE unchecked in this page as Eclipse

will be the one responsible for launching JIRA on Debug mode:

Page 63: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 63 of 88

Setup will then extract and install the files needed to run JIRA:

During setup, JIRA will launch and a Tomcat prompt may appear, this

condition is normal and part of the setup process:

Page 64: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 64 of 88

In the following window, just leave the LAUNCH JIRA ENTERPRISE

EDITION IN BROWSER option checked and click the FINISH button.

After clicking FINISH, JIRA will open a browser and direct you to its SETUP page. Enter the following settings, either way this local instance

will be for plug-in testing alone and thus changing these settings need not be strictly complied upon as compared to a production release copy.

Enter the following details on Step 1 and click NEXT:

Application Title: JIRA Local

Mode: Private Base URL: http://localhost:8080

Index path: C:\idx Attachment path: C:\attachment

Enable backups: No

License: [Refer to MSG IT Environments Team for a license key]

Page 65: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 65 of 88

The page should appear similar to the following:

Page 66: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 66 of 88

Enter the following details on Step 2 and click NEXT:

Username: admin

Password: admin Confirm: admin

Full name: Test Administrator Email: [email protected]

Page 67: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 67 of 88

Click Disable Email Notifications on Step 3:

Page 68: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 68 of 88

Setup should now have been completed. Click “log in to JIRA” to test

login using the admin account:

Page 69: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 69 of 88

C. Testing JIRA Enterprise Edition Installation

Enter the login credentials in the following page:

Page 70: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 70 of 88

Should login succeed, the dashboard of JIRA will appear similar to the

following:

Page 71: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 71 of 88

V. Creating a Simple “Hello World” JIRA Plug-in

A. Sample Project Requirements

Libraries of JIRA’s Product Development Kit can be retrieved from the following address:

http://www.megaupload.com/?d=FK7NNMJR

Open the archive file and extract all files into C:\ in the same way that Maven 2 was extracted.

Open the RUN WINDOW by pressing WINDOWS KEY + R and open a

Command Prompt by entering the following:

cmd

As shown in the following illustration:

Once the Command Prompt loads, enter the following values:

mkdir HelloWorld

cd HelloWorld

mvn install:install-file -DgroupId=javax.activation -DartifactId=activation -Dversion=1.0.2 -Dpackaging=jar -Dfile=C:/jaf-

1_1_1.zip

As shown in the following:

Page 72: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 72 of 88

When a BUILD SUCCESSFUL notification appears, enter the following

values as well:

mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create -DarchetypeGroupId=com.atlassian.maven.archetypes -

DarchetypeArtifactId=jira-plugin-archetype -DarchetypeVersion=10 -DremoteRepositories=https://maven.atlassian.com/repository/public/ -

DgroupId=com.macquarie.jira.plugins -DartifactId=HelloWorld

mkdir src\main\resources\includes\images

The following code will create the skeleton structure of the project in your HelloWorld folder located at your Desktop.

Open the HelloWorld folder and access the atlassian-plugin.xml located

in src\main\resources using Notepad. Delete all its contents and replace

it with the following:

<atlassian-plugin key="com.macquarie.jira.plugins.MyPlugin" name="Hello World!">

<plugin-info> <description>Displays the string Hello World!</description>

<version>1.0</version> </plugin-info>

<resource type="download" name="images/" location="includes/images/" />

<portlet key="myplugin" name="My Plugin" class="com.macquarie.jira.plugins.MyPlugin">

<description key="portlet.myplugin.description">i18n description <resource type="velocity" name="view"

location="templates/myplugin/myplugin.vm" /> <label

key="portlet.myplugin.name" /> <thumbnail>download/resources/com.macquarie.jira.plugins.MyPlugin:

myplugin/images/myplugin.png <objectdescriptor key="portlet.myplugin.display.name" />

</portlet> </atlassian-plugin>

Page 73: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 73 of 88

B. Importing the Sample Project to Eclipse

Copy the HelloWorld folder (extracted onto your C:\ as well) into your

Desktop and overwrite its entire content.

Open your Eclipse IDE, click File from the menu bar and select IMPORT as shown below:

Page 74: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 74 of 88

On the import form, expand the GENERAL list and select MAVEN

PROJECTS as shown and click NEXT:

Page 75: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 75 of 88

Browse to your Desktop folder and look for your project folder, select it

and click OK:

Eclipse will be able to detect the Maven project based from the pom.xml file. Simply click FINISH and the project will be added to your PROJECT

EXPLORER:

Page 76: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 76 of 88

Once the import is done, Hello World should be added to your Project

Explorer. Right-click on its folder and select Properties as shown below:

Page 77: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 77 of 88

The Properties Page will appear and will show the project’s Build Path. Click on Libraries and select ADD EXTERNAL JAR as shown below:

Page 78: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 78 of 88

A JAR Selection Window will appear. Go to your C:\ drive and open the

libraries folder. Select all the files and click OPEN as shown:

All of the required libraries from the Plug-in Development Kit are now added onto the portlet’s build path.

Page 79: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 79 of 88

The libraries will then be listed and you may now click OK as shown:

Page 80: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 80 of 88

C. Creating a Run Configuration for the Sample Project

After adding the JIRA Plug-in Development Kit libraries, it is time to

connect Eclipse with JIRA’s built-in Tomcat Server. To do so, click Run in the menu bar, select External Tools, and open External Tools

Configuration:

Page 81: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 81 of 88

In the External Tools Configuration, click on PROGRAM and then click on

the NEW button boxed in red below:

Page 82: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 82 of 88

A new_configuration will pop up and you’ll need to fill-it up with the

following values:

Name: JIRA Server Location: C:\Program Files\JIRA-Enterprise-3.13.5\bin\catalina.bat

Working Directory: C:\Program Files\JIRA-Enterprise-3.13.5\ Arguments: jpda run

As shown below:

Page 83: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 83 of 88

Next, click on the ENVIRONMENT tab, click NEW, and enter the

following values:

Name: JAVA_OPTS Value: -server -XX:+UseParallelGC -Xmx768m -

XX:MaxPermSize=160m -Djava.awt.headless=true

Name: JPDA_ADDRESS Value: 8000

Name: JPDA_TRANSPORT

Value: dt_socket

These three (3) values are required to be set as Environment variables, as shown here:

Click APPLY after setting the variables and click the COMMON TAB.

Page 84: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 84 of 88

In the common tab, make sure that EXTERNAL TOOLS is checked as

shown below:

Click APPLY and select CLOSE to exit the EXTERNAL TOOLS CONFIGURATION.

Page 85: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 85 of 88

D. Packaging the Sample Project to a JAR file

Now right-click the HelloWorld project, select RUN AS, and click MAVEN PACKAGE.

This will produce a .jar file whose location will be indicated in the console. Copy this .jar file to:

C:\Program Files\JIRA-Enterprise-3.13.5\atlassian-jira\WEB-INF\lib

Page 86: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 86 of 88

E. Breakpoint lines from the Sample Project

Expand the HelloWorld Project in the Project Explorer and open MyPlugin.java as shown below:

Double-click on it to view the code and make a breakpoint in the return new HashMap area as shown below:

Page 87: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 87 of 88

F. Remotely debug the Sample Project

Click on the Run Configuration Tools Icon below the menu bar and launch JIRA Server as shown below:

The console will state that it is starting JIRA with a listening socket set

at port 8000 based from the environment variables set early on.

Open JIRA by accessing it on your Programs list:

Login to your account and go to ADMINISTRATION and view the PLUGINS list. It should display your plug-in and the focus of will shift to

Eclipse upon instantiation of its code.

Parts of this chapter have been retrieved from Mr. Ximon Eighteen.

Page 88: Configuring Eclipse for Debugging JIRA Plugins

Configuring Eclipse for Debugging JIRA Plug-ins

Page 88 of 88

After debugging, you can stop JIRA’s server by going back to JIRA in

the PROGRAMS LIST and click STOP JIRA SERVER [8080] as shown below:

-END OF DOCUMENT-