Third-party dependency in Jira plugin

Peter Vestberg September 23, 2011

Hi,

I am developing a JIRA plugin which connects to an external MSSQL database. For this reason, I have added a dependency in my pom.xml to Microsoft's JDBCs driver in order to connect and run db queries:

<dependency>
            <groupId>com.microsoft.sqlserver.jdbc</groupId>
            <artifactId>SQLServerDriver</artifactId>
            <version>3.0</version>
            <scope>compile</scope>
        </dependency>

When I run "pi" from the plugin SDK CLI or atlas-compile, etc., I always get:

Downloading: https://m2proxy.atlassian.com/repository/public/com/microsoft/sqlserver/jdbc/SQLServerDriver/3.0/SQLServerDriver-3.0.pom<span< a=""> id="mce_0_start" style="overflow: hidden; line-height: 0px;">
Unable to find resource 'com.microsoft.sqlserver.jdbc:SQLServerDriver:pom in repository central (
http://repo1.maven.org/maven2)

This is understandable because it doesn't exist there. So I tried adding the JDBC jar to my local Maven repository, e.g. to C:\Documents and Settings\xxx\.m2\repository\com\microsoft\sqlserver\jdbc\SQLServerDriver\3.0

Now my plugin finds the driver, but still tries to download it first when building/deploying. So,

How can I prevent Maven from attempting to download my dependency?
And out of curiosity, where do dependency jars for a plugin end up in the jira folder? Are they bundled within the plugin or located in some common folder (like META-INF)?

Thanks

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 23, 2011

Instead of manually copying it into repositories folder, install it using mvn install and see if it helps. Also, in the plugin it ends up in META-INF/lib if it is a v2 plugin. For v1 plugins, it is packaged into the jar.

2 votes
Wojciech Seliga
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 25, 2011

Hi,

In these concrete circumstances consider using JTDS JDBC driver for MS SQL which is bundled with JIRA standalone and which is normally used when JIRA runs against MS SQL (Atlassian recommends against using Microsoft JDBC drivers due to many problems reported - http://confluence.atlassian.com/display/JIRA/Connecting+JIRA+to+SQL+Server+2005).

Then you don't need to bundle such JDBC driver at all and you can reuse the driver available in the classpath. Please note that JDBC drivers are not distributed with Atlassian SDK, so JIRA launched from it will not have such drivers OOB.

Please see https://answers.atlassian.com/questions/10672/getting-java-lang-classnotfoundexception-com-mysql-jdbc-driver-while-connecting-to-external-mysql-database for more details on how to cope with it.

1 vote
grundic
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 23, 2011

I'm not 100% shure, but maybe artifactId is incorrect?

http://www.mvnbrowser.com/artifacts-browse.html?groupId=com.microsoft.sqlserver

Try:

<dependency>
<groupId>com.microsoft.sqlserver.jdbc</groupId>
<artifactId>sqljdbc</artifactId>
<version>2.0</version>
</dependency>


Peter Vestberg September 23, 2011

But I do want to use version 3 of the driver. And what if I have a dependency that is not available in any of the public Maven repositories? As far as I understand, the way to go then is to add it to my local Maven repo, but I haven't had any success with that :O

grundic
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 23, 2011

Well, try to change version to 3.0 :)

I'm not a maven guru, but yes, if you need to add restricted libraries you have to add them by hand.

There is working example on Building Jira From Source WiKi page - give it a try.

TAGS
AUG Leaders

Atlassian Community Events