newuser014
newuser014

Reputation: 35

How to download software dependencies in Maven 2?

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.

Upvotes: 3

Views: 2903

Answers (2)

sethupathi.t
sethupathi.t

Reputation: 502

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.

Upvotes: 0

Perception
Perception

Reputation: 80633

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>

Upvotes: 1

Related Questions