How to develop with WTP Tomcat Maven2
A way to build a developpement based on :
- WTP 0.7.0 (based on Eclipse 3.1.0), free and more light than WSAD 5.1.2 and RAD 6.0 used at the office.
- Tomcat 5.0.28 : The configuration of this release has been more easy for me with Eclipse and JIRA.
- Maven 2.0.1 : I know that Atlassian team has not yet made the upgrade to this release, but why not ?
Tools Installation / Configuration
- Maven 2.0.1 : Standard installation ...
System Env. Variable M2_HOME set to Maven Root installation
Default %USERPROFILE%\.m2\settings.xml with <mirrors> and <localRepository> sections updated - Tomcat 5.0.28 : Nothing special ... See Install an Appserver
- Eclipse / WTP :
- a Classpath variable M2_REPO configured in Preferences settings.
- Declare the Tomcat Runtime ( Preferences/Server/Installed runtime ), with correct setting :
- A Runtime Name : i.e Tomcat v5.O Server
- The Runtime location
- A JRE
JIRA Distribution in this environment
Integrate JIRA Distribution in Eclipse, I process as follow :
- Creation of to "Simple Eclipse Project" :
- atlassian-jira-enterprise-3.5
- atlassian-jira-enterprise-3.5-source
- Download and Unpack corresponding JIRA distribution files.
- Launch the build : build.bat
Let default configuration based on Tomcat/HSQL
Import Tomcat WAR File as Eclipse Project :
- Launch File / Import,

- Select WAR File to Import from atlassian-jira-enterprise-3.5\dist-tomcat\atlassian-jira-3.5.war
- WEB Project Name will be deduced from WAR File Name and should not already exist in Workspace (i.e. atlassian-jira-3_5)
- Select Tomcat 5.0 Server Runtime with correct location and JRE (Create it if not yet done)
- Click on Finish to perform Import

- Correct the Classpath (not correctly generated). You should have
<?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry output=".deployables/atlassian-jira-3_5/WEB-INF/classes" kind="src" path="JavaSource"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container/atlassian-jira-3_5"/> <classpathentry exported="true" sourcepath="/atlassian-jira-enterprise-3.5-source" kind="lib" path="atlassian-jira-3_5_ImportedClasses/importedClasses.jar"/> <classpathentry kind="output" path="bin"/> </classpath>
All classpathentry based on WebContent Directory should be removed
<classpathentry sourcepath="WebContent/WEB-INF/lib/*" kind="lib" path="WebContent/WEB-INF/lib/*"/>because all jar are already provided by classpathentry container ...
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container/atlassian-jira-3_5"/>
- Copy atlassian-jira-enterprise-3.5\dist-tomcat\tomcat-5\jira.xml to atlassian-jira-3_5\WebContent\META-INF\context.xml
Plugin Developpement :
I made the choice to use a project dedicated to the Build of my plugins.
To do that, the project jira-plugin-kaamelot has the following structure :

- CODEGEIST:pom.xml file, in \jira-plugin-kaamelot\atlassian-jira-3.5 directory, with package type to "pom", provides JIRA dependencies,
This pom.xml file has been built manualy from Maven 1 project.xml
(\atlassian-jira-enterprise-3.5-source\jira\project.xml - CODEGEIST:pom.xml file, in \jira-plugin-kaamelot directory, is used to build referenced plugin, and as parent pom.xml for this plugins.
"Install" JIRA Runtime
The JIRA Runtime have to be installed in the Local Repository. To do that :
- In command line, cd \jira-plugin-kaamelot\atlassian-jira-3.5
- Execute mvn install
[CODEGEIST:INFO] Scanning for projects... [CODEGEIST:INFO] ---------------------------------------------------------------------------- [CODEGEIST:INFO] Building atlassian-jira [CODEGEIST:INFO] task-segment: [CODEGEIST:install] [CODEGEIST:INFO] ---------------------------------------------------------------------------- [CODEGEIST:INFO] Skipping missing optional mojo: org.apache.maven.plugins:maven-site-plugin:attach-descriptor [CODEGEIST:INFO] [install:install] [CODEGEIST:INFO] Installing C:\Workarea\eJira\jira-plugin-kaamelot\atlassian-jira-3.5\pom.xml to C:\Workarea\_Repositories\m2\com\atlassian\atlassian-jira\3.5\atlassian-jira-3.5.pom Downloading: http://www.ibiblio.net/pub/packages/maven2/org/apache/lucene/1.4.3/lucene-1.4.3.pom [CODEGEIST:WARNING] Unable to get resource from repository central (http://repo1.maven.org/maven2) [CODEGEIST:INFO] [antrun:run {execution: default}] [CODEGEIST:INFO] Executing tasks [CODEGEIST:copy] Copying 1 file to C:\Workarea\_Repositories\m2\com\atlassian\atlassian-jira\3.5 [CODEGEIST:copy] Copying C:\Workarea\eJira\jira-plugin-kaamelot\atlassian-jira-3.5\atlassian-jira-3.5.jar to C:\Workarea\_Repositories\m2\com\atlassian\atlassian-jira\3.5\atlassian-jira-3.5.jar [CODEGEIST:INFO] Executed tasks [CODEGEIST:INFO] ---------------------------------------------------------------------------- [CODEGEIST:INFO] BUILD SUCCESSFUL [CODEGEIST:INFO] ---------------------------------------------------------------------------- [CODEGEIST:INFO] Total time: 18 seconds [CODEGEIST:INFO] Finished at: Sun Feb 12 19:59:52 CET 2006 [CODEGEIST:INFO] Final Memory: 4M/8M [CODEGEIST:INFO] ----------------------------------------------------------------------------
Project Plugin Creation
Follow the below steps :
- Create the Eclipse Project
- Due to Maven 2 standards, your Plugin should apply the following structure :
/src/ main/ java/ resources/ /atlassian-plugin.xml test/ java/ resources/ /pom.xml - Update the pom.xml file with above Build Project as parent. i.e. see pom.xml of jira-plugin-kaamelot-addon.
<?xml version="1.0" encoding="ISO-8859-1"?> <project> <modelVersion>4.0.0</modelVersion> <parent> <groupId>fr.kaamelot.atlassian.jira</groupId> <artifactId>jira-plugin-kaamelot</artifactId> <version>0.1.0</version> </parent> <groupId>fr.kaamelot.atlassian.jira</groupId> <artifactId>jira-plugin-kaamelot-addon</artifactId> <name>jira-plugin-kaamelot-addon</name> <version>0.1.0</version> <dependencies> <dependency> <groupId>commons-io</groupId> <artifactId>commons-io</artifactId> <version>1.1</version> </dependency> </dependencies> </project>
- Generate the Eclipse Classpath from pom.xml
- In command line, cd \jira-plugin-kaamelot-addon
- Execute mvn eclipse:eclipse
[CODEGEIST:INFO] Scanning for projects... [CODEGEIST:INFO] Searching repository for plugin with prefix: 'eclipse'. [CODEGEIST:INFO] ---------------------------------------------------------------------------- [CODEGEIST:INFO] Building jira-plugin-kaamelot-addon [CODEGEIST:INFO] task-segment: [eclipse:eclipse] [CODEGEIST:INFO] ---------------------------------------------------------------------------- [CODEGEIST:INFO] Preparing eclipse:eclipse [CODEGEIST:INFO] No goals needed for project - skipping Downloading: http://www.ibiblio.net/pub/packages/maven2/org/apache/lucene/1.4.3/lucene-1.4.3.pom [CODEGEIST:WARNING] Unable to get resource from repository central (http://repo1.maven.org/maven2) [CODEGEIST:INFO] [eclipse:eclipse] [CODEGEIST:INFO] File C:\Workarea\eJira\jira-plugin-kaamelot-addon\.project already exists. Additional settings will be preserved, run mvn eclipse:clean if you want old settings to be removed. [CODEGEIST:INFO] Not writing settings - defaults suffice [CODEGEIST:INFO] Sources for some artifacts are not available. Please run "mvn -Declipse.downloadSources=true eclipse:eclipse" in order to check remote repositories for sources. List of artifacts without a source archive: o ... [CODEGEIST:INFO] Wrote Eclipse project for "jira-plugin-kaamelot-addon" to C:\Workarea\eJira\jira-plugin-kaamelot-addon. [CODEGEIST:INFO] ---------------------------------------------------------------------------- [CODEGEIST:INFO] BUILD SUCCESSFUL [CODEGEIST:INFO] ---------------------------------------------------------------------------- [CODEGEIST:INFO] Total time: 4 seconds [CODEGEIST:INFO] Finished at: Sun Feb 12 20:41:00 CET 2006 [CODEGEIST:INFO] Final Memory: 3M/6M [CODEGEIST:INFO] ----------------------------------------------------------------------------
- Refresh Project resources under Eclipse
The WST Builder will update the generated Classpath as follow<classpathentry output=".deployables/jira-plugin-XXX" kind="src" path="src/main/java"/> <classpathentry output=".deployables/jira-plugin-XXX" kind="src" path="src/main/resources"/>
Integration of Plugin :
When your Plugin Project is created, then it can be referenced in JIRA Web Project (i.e. atlassian-jira-3_5), as follow :
From Project Properties,
- In Java Build Path, add your project as Project

- In Project References, select your project

- Apply modification.
After, a .wtpmodules file should be updated with your project as dependence of JIRA WEB Project<dependent-module deploy-path="/WEB-INF/lib" handle="module:/resource/jira-plugin-XXX/jira-plugin-XXX"> <dependency-type>uses</dependency-type> </dependent-module>
Now, Eclipse take in charge :
- Compilation of java file to .deployables/jira-plugin-XXX" directory,
- Copy of resource to .deployables/jira-plugin-XXX" directory,
- Build of Jar File from .deployables/jira-plugin-XXX" directory,
and copy of it to .deployables\XXX\WEB-INF\lib of referencing project.
(i.e. atlassian-jira-3_5\.deployables\atlassian-jira-3_5\WEB-INF\lib)
Plugin Deployment :
To deploy created plugins, follow below steps :
-
- From the root of the Build Project
- Execute mvn install ... (i.e. for jira-plugin-kaamelot Project)
[CODEGEIST:INFO] Scanning for projects... [CODEGEIST:INFO] Reactor build order: [CODEGEIST:INFO] jira-plugin-kaamelot [CODEGEIST:INFO] jira-plugin-kaamelot-addon [CODEGEIST:INFO] jira-plugin-kaamelot-fastworklog [CODEGEIST:INFO] jira-plugin-kaamelot-timesheet [CODEGEIST:INFO] ---------------------------------------------------------------------------- [CODEGEIST:INFO] Building jira-plugin-kaamelot [CODEGEIST:INFO] task-segment: [CODEGEIST:install] [CODEGEIST:INFO] ---------------------------------------------------------------------------- [CODEGEIST:INFO] Skipping missing optional mojo: org.apache.maven.plugins:maven-site-plugin:attach-descriptor Downloading: http://www.ibiblio.net/pub/packages/maven2/org/apache/lucene/1.4.3/lucene-1.4.3.pom [CODEGEIST:WARNING] Unable to get resource from repository central (http://repo1.maven.org/maven2) [CODEGEIST:INFO] [antrun:run {execution: default}] [CODEGEIST:INFO] Executing tasks [CODEGEIST:copy] Warning: Could not find file C:\Workarea\eJira\jira-plugin-kaamelot\target\jira-plugin-kaamelot-0.1.0.pom to copy. [CODEGEIST:INFO] Executed tasks [CODEGEIST:INFO] [install:install] [CODEGEIST:INFO] Installing C:\Workarea\eJira\jira-plugin-kaamelot\pom.xml to C:\Workarea\_Repositories\m2\fr\kaamelot\atlassian\jira\jira-plugin-kaamelot\0.1.0\jira-plugin-kaamelot-0.1.0.pom [CODEGEIST:INFO] ---------------------------------------------------------------------------- [CODEGEIST:INFO] Building jira-plugin-kaamelot-addon [CODEGEIST:INFO] task-segment: [CODEGEIST:install] [CODEGEIST:INFO] ---------------------------------------------------------------------------- [CODEGEIST:INFO] [resources:resources] [CODEGEIST:INFO] Using default encoding to copy filtered resources. [CODEGEIST:INFO] [compiler:compile] [CODEGEIST:INFO] Nothing to compile - all classes are up to date [CODEGEIST:INFO] [resources:testResources] [CODEGEIST:INFO] Using default encoding to copy filtered resources. [CODEGEIST:INFO] [compiler:testCompile] [CODEGEIST:INFO] No sources to compile [CODEGEIST:INFO] [surefire:test] [CODEGEIST:INFO] No tests to run. [CODEGEIST:INFO] [jar:jar] [CODEGEIST:INFO] Building jar: C:\Workarea\eJira\jira-plugin-kaamelot\..\jira-plugin-kaamelot-addon\target\jira-plugin-kaamelot-addon-0.1.0.jar [CODEGEIST:INFO] [antrun:run {execution: default}] [CODEGEIST:INFO] Executing tasks [CODEGEIST:copy] Copying 1 file to C:\Workarea\eJira\jira-plugin-kaamelot\build-0.1.0\edit-webapp\WEB-INF\lib [CODEGEIST:copy] Copying C:\Workarea\eJira\jira-plugin-kaamelot-addon\target\jira-plugin-kaamelot-addon-0.1.0.jar to C:\Workarea\eJira\jira-plugin-kaamelot\build-0.1.0\edit-webapp\WEB-INF\lib\jira-plugin-kaamelot-addon-0.1.0.jar [CODEGEIST:INFO] Executed tasks [CODEGEIST:INFO] [install:install] [CODEGEIST:INFO] Installing C:\Workarea\eJira\jira-plugin-kaamelot\..\jira-plugin-kaamelot-addon\target\jira-plugin-kaamelot-addon-0.1.0.jar to C:\Workarea\_Repositories\m2\fr\kaamelot\atlassian\jira\jira-plugin-kaamelot-addon\0.1.0\jira-plugin-kaamelot-addon-0.1.0.jar [CODEGEIST:INFO] ---------------------------------------------------------------------------- [CODEGEIST:INFO] Building jira-plugin-kaamelot-fastworklog [CODEGEIST:INFO] task-segment: [CODEGEIST:install] [CODEGEIST:INFO] ---------------------------------------------------------------------------- [CODEGEIST:INFO] [resources:resources] [CODEGEIST:INFO] Using default encoding to copy filtered resources. [CODEGEIST:INFO] [compiler:compile] [CODEGEIST:INFO] Nothing to compile - all classes are up to date [CODEGEIST:INFO] [resources:testResources] [CODEGEIST:INFO] Using default encoding to copy filtered resources. [CODEGEIST:INFO] [compiler:testCompile] [CODEGEIST:INFO] No sources to compile [CODEGEIST:INFO] [surefire:test] [CODEGEIST:INFO] No tests to run. [CODEGEIST:INFO] [jar:jar] [CODEGEIST:INFO] Building jar: C:\Workarea\eJira\jira-plugin-kaamelot\..\jira-plugin-kaamelot-fastworklog\target\jira-plugin-kaamelot-fastworklog-0.1.0.jar [CODEGEIST:INFO] [antrun:run {execution: default}] [CODEGEIST:INFO] Executing tasks [CODEGEIST:copy] Copying 1 file to C:\Workarea\eJira\jira-plugin-kaamelot\build-0.1.0\edit-webapp\WEB-INF\lib [CODEGEIST:copy] Copying C:\Workarea\eJira\jira-plugin-kaamelot-fastworklog\target\jira-plugin-kaamelot-fastworklog-0.1.0.jar to C:\Workarea\eJira\jira-plugin-kaamelot\build-0.1.0\edit-webapp\WEB-INF\lib\jira-plugin-kaamelot-fastworklog-0.1.0.jar [CODEGEIST:INFO] Executed tasks [CODEGEIST:INFO] [install:install] [CODEGEIST:INFO] Installing C:\Workarea\eJira\jira-plugin-kaamelot\..\jira-plugin-kaamelot-fastworklog\target\jira-plugin-kaamelot-fastworklog-0.1.0.jar to C:\Workarea\_Repositories\m2\fr\kaamelot\atlassian\jira\jira-plugin-kaamelot-fastworklog\0.1.0\jira-plugin-kaamelot-fastworklog-0.1.0.jar [CODEGEIST:INFO] ---------------------------------------------------------------------------- [CODEGEIST:INFO] Building jira-plugin-kaamelot-timesheet [CODEGEIST:INFO] task-segment: [CODEGEIST:install] [CODEGEIST:INFO] ---------------------------------------------------------------------------- [CODEGEIST:INFO] [resources:resources] [CODEGEIST:INFO] Using default encoding to copy filtered resources. [CODEGEIST:INFO] [compiler:compile] [CODEGEIST:INFO] Nothing to compile - all classes are up to date [CODEGEIST:INFO] [resources:testResources] [CODEGEIST:INFO] Using default encoding to copy filtered resources. [CODEGEIST:INFO] [compiler:testCompile] [CODEGEIST:INFO] No sources to compile [CODEGEIST:INFO] [surefire:test] [CODEGEIST:INFO] No tests to run. [CODEGEIST:INFO] [jar:jar] [CODEGEIST:INFO] Building jar: C:\Workarea\eJira\jira-plugin-kaamelot\..\jira-plugin-kaamelot-timesheet\target\jira-plugin-kaamelot-timesheet-0.1.0.jar [CODEGEIST:INFO] [antrun:run {execution: default}] [CODEGEIST:INFO] Executing tasks [CODEGEIST:copy] Copying 1 file to C:\Workarea\eJira\jira-plugin-kaamelot\build-0.1.0\edit-webapp\WEB-INF\lib [CODEGEIST:copy] Copying C:\Workarea\eJira\jira-plugin-kaamelot-timesheet\target\jira-plugin-kaamelot-timesheet-0.1.0.jar to C:\Workarea\eJira\jira-plugin-kaamelot\build-0.1.0\edit-webapp\WEB-INF\lib\jira-plugin-kaamelot-timesheet-0.1.0.jar [CODEGEIST:INFO] Executed tasks [CODEGEIST:INFO] [install:install] [CODEGEIST:INFO] Installing C:\Workarea\eJira\jira-plugin-kaamelot\..\jira-plugin-kaamelot-timesheet\target\jira-plugin-kaamelot-timesheet-0.1.0.jar to C:\Workarea\_Repositories\m2\fr\kaamelot\atlassian\jira\jira-plugin-kaamelot-timesheet\0.1.0\jira-plugin-kaamelot-timesheet-0.1.0.jar [CODEGEIST:INFO] [CODEGEIST:INFO] [CODEGEIST:INFO] ---------------------------------------------------------------------------- [CODEGEIST:INFO] Reactor Summary: [CODEGEIST:INFO] ---------------------------------------------------------------------------- [CODEGEIST:INFO] jira-plugin-kaamelot ................................... SUCCESS [CODEGEIST:4.375s] [CODEGEIST:INFO] jira-plugin-kaamelot-addon ............................. SUCCESS [CODEGEIST:1.640s] [CODEGEIST:INFO] jira-plugin-kaamelot-fastworklog ....................... SUCCESS [CODEGEIST:0.469s] [CODEGEIST:INFO] jira-plugin-kaamelot-timesheet ......................... SUCCESS [CODEGEIST:0.250s] [CODEGEIST:INFO] ---------------------------------------------------------------------------- [CODEGEIST:INFO] ---------------------------------------------------------------------------- [CODEGEIST:INFO] BUILD SUCCESSFUL [CODEGEIST:INFO] ---------------------------------------------------------------------------- [CODEGEIST:INFO] Total time: 7 seconds [CODEGEIST:INFO] Finished at: Sun Feb 12 21:11:02 CET 2006 [CODEGEIST:INFO] Final Memory: 6M/11M [CODEGEIST:INFO] ----------------------------------------------------------------------------
