3

I am very new in using Maven. Appreciate if anyone can give me some helps.

I want to build a plugin for JIRA. I have installed Atlassian Plugin SDK which comes with Maven 2 (pre-bundled together).

In my Java source codes, I want to import these packages from Atlassian repository:

import com.atlassian.crowd.embedded.api.User;
import com.atlassian.jira.rpc.exception.*;
import com.atlassian.jira.rpc.auth.*;
import com.atlassian.jira.rpc.soap.beans.*;
import com.atlassian.jira.rpc.soap.service.*;
import com.atlassian.jira.rpc.soap.util.*;
import com.atlassian.jira.rpc.soap.JiraSoapServiceImpl;
import com.atlassian.jira.soap.axis.JiraSoapTokenResolver;
import org.apache.axis.encoding.Base64;

I have tried to use Maven to build another example plugin from Atlassian. I found that Maven is able to download all necessary dependencies packages from the repository and build the application without any problems.

However, when I use Maven to build my own plugin, it failed to download the dependencies from Atlassian repository. It shows the following error messages:

...
xxxxx.java:[x,x] package com.atlassian.jira.rpc.exception does not exist
xxxxx.java:[x,x] package com.atlassian.jira.rpc.auth does not exist
xxxxx.java:[x,x] package com.atlassian.jira.rpc.soap.beans does not exist
xxxxx.java:[x,x] package com.atlassian.jira.rpc.soap.service does not exist
xxxxx.java:[x,x] package com.atlassian.jira.rpc.soap.util does not exist
xxxxx.java:[x,x] package com.atlassian.jira.rpc.soap does not exist
...

xxxxx.java:[x,x] cannot find symbol
symbol: class JiraSoapService
...

In my pom.xml, I have included these:

<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>atlassian-jira</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>

In the Maven settings.xml file, I can see these repositories (default settings.xml in Maven 2 which is pre-bundled with Atlassian Plugin SDK installation):

<repositories>
<repository>
<id>atlassian-public</id>
<url>https://m2proxy.atlassian.com/repository/public</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>daily</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</repository>
<repository>
<id>atlassian-plugin-sdk</id>
<url>file://${env.ATLAS_HOME}/repository</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>atlassian-public</id>
<url>https://m2proxy.atlassian.com/repository/public</url>
<releases>
<enabled>true</enabled>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>

I have spent a long time to compare my pom.xml with other JIRA plugin's pom.xml. But i still don't understand how to ask Maven to download JIRA packages from Atlassian repository.

Can anyone give me some helps? Thanks.

newuser014
  • 35
  • 1
  • 4
  • It should download the required dependencies if you do `mvn compile` – jmj Dec 17 '11 at 15:03
  • @Jigar The Atlassian Plugin SDK recommend user to use the pre-bundled Maven to compile plugin for JIRA. I have tried `atlas-compile`, `atlas-mvn compile`, but it says `BUILD FAILURE.. compilation failure.. package com.atlassian.jira.rpc.xxx does not exists` – newuser014 Dec 17 '11 at 15:12
  • try to do `mvn compile` once to download all required libraries from the directory where your POM including required dependencies resides – jmj Dec 17 '11 at 15:15
  • @Jigar I just installed a new, standalone Maven 2.2.1. I use `mvn compile` in the directory of my `pom.xml`. It shows the same error messages like the one mentioned above. – newuser014 Dec 17 '11 at 15:28
  • I hope pom file contains the dependencies to the library which has these classes (mentioned in import statements) – jmj Dec 17 '11 at 15:29
  • I am very new in using Maven. My pom.xml contains these lines ` com.atlassian.jira atlassian-jira ${jira.version} provided `. Is this enough to ask Maven to download the packages in my codes, e.g. `import com.atlassian.jira.rpc.soap.beans.*`, etc? Anything else that i should add to my pom.xml? – newuser014 Dec 17 '11 at 15:32
  • I am not sure about these libraries if you can check them online if they contains the required classes – jmj Dec 17 '11 at 15:33
  • @Jigar This page (`https://developer.atlassian.com/display/DOCS/Atlassian+Maven+Repositories`) shows the list of Atlassian repositories. It recommends using this `https://maven.atlassian.com/content/groups/public/`. But i don't know how to find the available packages, e.g. how to find com.atlassian.jira.rpc.xxx? Can you give me some helps? Thanks. – newuser014 Dec 17 '11 at 15:46
  • Check out findjar.com search for the class and it will give you jar containing the class, try to check if that jar is listed in your dependencies – jmj Dec 17 '11 at 15:52
  • @Jigar Personally I think if Maven can't find the dependencies packages in the repositories, it should have generated some error messages saying that it can't find the required packages in repository. But i didn't see this kind of error messages. So i think there must be something wrong with my `pom.xml` or `settings.xml`. It seems that Maven does not even attempt to download anything when i compile my codes. – newuser014 Dec 17 '11 at 15:55
  • May be.. try with sample maven application that download a small single jar from that list to see if it works – jmj Dec 17 '11 at 15:57
  • @Jigar If i want to `import com.atlassian.jira.rpc.soap.bean.*;`, how should i write the dependency in my `pom.xml`? Can you give me a simple example? Thanks. – newuser014 Dec 17 '11 at 16:02
  • well each jar is hosted on particular repository of maven, but the mostly used and commons and listed are available on central repos of maven I tried searching for this one on central it is not there you might be able to find these jars from the repositories mentioned in your pom with ` ` tag – jmj Dec 17 '11 at 16:06

2 Answers2

1

Your code is not compiling because the packages you are including are not contained in the atlassian-jira JAR. It looks like you will need at least the following additional dependency:

<dependency>
  <groupId>atlassian-jira-rpc-plugin</groupId>
  <artifactId>atlassian-jira-rpc-plugin</artifactId>
</dependency>

But I could not find it in the JIRA repo. You might have to Google to find out what repository its in (or install it manually, locally).

EDIT

To install a JAR into your repository you can use the following command:

mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \
    -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
Perception
  • 79,279
  • 19
  • 185
  • 195
  • I have added this dependency in my `pom.xml` (with version=4.4.1 and scope=provided) but Maven can't find it in the repo. When I go to `~\.m2\repository\com\atlassian\jira\plugins\atlassian-jira-rpc-plugin\4.4.1`, I found this jar file `atlassian-jira-rpc-plugin-4.4.1.jar`. Is this the `jar` file needed to compile my codes? – newuser014 Dec 17 '11 at 17:12
  • Yea, I couldn't find it in the repo either (as I mentioned in my answer). But the one you found is indeed the correct one to link to your IDE. – Perception Dec 17 '11 at 17:43
0

check whether mentioned version of jira jar is available in remote repository(https://m2proxy.atlassian.com/repository/public)?, if it is not available change the version,which one has complete jar.

sethupathi.t
  • 502
  • 2
  • 6