Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

POM not picking 3rd party repository

Tayyab Bashir
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.
June 30, 2016

Hi,

I have a plugin which has a 3rd party dependency on it.
I'm trying to resolve that dependency by adding the 3rd party's repository into my POM.

However, while building, my pom fails to pick the repository and instead it only looks for dependency resolution in the Local Maven .m2 folder.
The error it gives while compiling is that it couldn't resolve the dependency because it failed to find it in local maven repository.

My question is that why is it not Picking the 3rd party repository? And how can i handle the dependency? (I donn't want to install the 3rd party .jar manually).

1 answer

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
Petar Petrov (Appfire)
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.
June 30, 2016

There could be various reasons for that - paste your pom.xml, and also run maven with -X and paste the errors you are seeing.

Tayyab Bashir
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.
June 30, 2016

The 3rd party plugin in question is: jira-suite-utilities

POM File 

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.ublox.jira.plugins</groupId>
	<artifactId>Scripts</artifactId>
	<version>1.0.0-SNAPSHOT</version>
	<organization>
		<name>Example Company</name>
		<url>http://www.example.com/</url>
	</organization>
	<name>Scripts</name>
	<description>This is the com.ublox.jira.plugins:Scripts plugin for Atlassian JIRA.</description>
	<packaging>atlassian-plugin</packaging>

	<repositories>
		<repository>
			<id>sgn_work</id>
			<name>Sgonico/Work</name>
			<url>http://10.0.253.80/content/repositories/sgn_work</url>
		</repository>

		<repository>
			<id>jira-suite</id>
			<name>Googlecode</name>
			<url>https://maven.atlassian.com/content/repositories/atlassian-public/com/googlecode/jira-suite-utilities/</url>
		</repository>
	</repositories>
	<distributionManagement>
		<repository>
			<id>ubx_nexus</id>
			<name>Internal Releases</name>
			<url>http://10.0.253.80/content/repositories/sgn_work/jira_plugins/releases</url>
		</repository>
		<snapshotRepository>
			<id>ubx_nexus</id>
			<name>Internal Snapshots</name>
			<url>http://10.0.253.80/content/repositories/sgn_snapshots/jira_plugins/snapshots</url>
		</snapshotRepository>
	</distributionManagement>
	<dependencies>
		<dependency>
			<groupId>com.atlassian.jira</groupId>
			<artifactId>jira-api</artifactId>
			<version>${jira.version}</version>
			<scope>provided</scope>
		</dependency>
		<!-- Add dependency on jira-core if you want access to JIRA implementation 
			classes as well as the sanctioned API. -->
		<!-- This is not normally recommended, but may be required eg when migrating 
			a plugin originally developed against JIRA 4.x -->
		<!-- <dependency> <groupId>com.atlassian.jira</groupId> <artifactId>jira-core</artifactId> 
			<version>${jira.version}</version> <scope>provided</scope> </dependency> -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.10</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.atlassian.plugin</groupId>
			<artifactId>atlassian-spring-scanner-annotation</artifactId>
			<version>${atlassian.spring.scanner.version}</version>
			<scope>compile</scope>
		</dependency>
		<dependency>
			<groupId>com.atlassian.plugin</groupId>
			<artifactId>atlassian-spring-scanner-runtime</artifactId>
			<version>${atlassian.spring.scanner.version}</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>javax.inject</groupId>
			<artifactId>javax.inject</artifactId>
			<version>1</version>
			<scope>provided</scope>
		</dependency>
		<!-- WIRED TEST RUNNER DEPENDENCIES -->
		<dependency>
			<groupId>com.atlassian.plugins</groupId>
			<artifactId>atlassian-plugins-osgi-testrunner</artifactId>
			<version>${plugin.testrunner.version}</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>javax.ws.rs</groupId>
			<artifactId>jsr311-api</artifactId>
			<version>1.1.1</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>com.google.code.gson</groupId>
			<artifactId>gson</artifactId>
			<version>2.2.2-atlassian-1</version>
		</dependency>
		<!-- Uncomment to use TestKit in your project. Details at https://bitbucket.org/atlassian/jira-testkit -->
		<!-- You can read more about TestKit at https://developer.atlassian.com/display/JIRADEV/Plugin+Tutorial+-+Smarter+integration+testing+with+TestKit -->
		<!-- <dependency> <groupId>com.atlassian.jira.tests</groupId> <artifactId>jira-testkit-client</artifactId> 
			<version>${testkit.version}</version> <scope>test</scope> </dependency> -->
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-all</artifactId>
			<version>1.8.5</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>javax.servlet</groupId>
			<artifactId>servlet-api</artifactId>
			<version>2.4</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>javax.xml.bind</groupId>
			<artifactId>jaxb-api</artifactId>
			<version>2.1</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>com.atlassian.plugins.rest</groupId>
			<artifactId>atlassian-rest-common</artifactId>
			<version>1.0.2</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>com.atlassian.sal</groupId>
			<artifactId>sal-api</artifactId>
			<version>2.6.0</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>com.googlecode</groupId>
			<artifactId>jira-suite-utilities</artifactId>
			<version>1.5.0</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.apache.wink</groupId>
			<artifactId>wink-client</artifactId>
			<version>1.1.3-incubating</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>1.6.6</version>
			<scope>provided</scope>
		</dependency>
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<groupId>com.atlassian.maven.plugins</groupId>
				<artifactId>maven-jira-plugin</artifactId>
				<version>${amps.version}</version>
				<extensions>true</extensions>
				<configuration>
					<productVersion>${jira.version}</productVersion>
					<productDataVersion>${jira.version}</productDataVersion>
					<enableQuickReload>true</enableQuickReload>
					<enableFastdev>false</enableFastdev>
				</configuration>
			</plugin>
			<plugin>
				<groupId>com.atlassian.plugin</groupId>
				<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
				<version>1.2.6</version>
				<executions>
					<execution>
						<goals>
							<goal>atlassian-spring-scanner</goal>
						</goals>
						<phase>process-classes</phase>
					</execution>
				</executions>
				<configuration>
					<scannedDependencies>
						<dependency>
							<groupId>com.atlassian.plugin</groupId>
							<artifactId>atlassian-spring-scanner-external-jar</artifactId>
						</dependency>
					</scannedDependencies>
					<verbose>false</verbose>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
				</configuration>
			</plugin>
		</plugins>
	</build>
	<properties>
		<jira.version>7.0.10</jira.version>
		<amps.version>6.1.2</amps.version>
		<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
		<atlassian.spring.scanner.version>1.2.6</atlassian.spring.scanner.version>
		<!-- This key is used to keep the consistency between the key in atlassian-plugin.xml 
			and the key to generate bundle. -->
		<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
		<!-- TestKit version 6.x for JIRA 6.x -->
		<testkit.version>6.3.11</testkit.version>
	</properties>
</project>

 

ERRORS

[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.ublox.jira.plugins:Scripts:atlassian-plugin:1.0.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 191, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Scripts 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.googlecode:jira-suite-utilities:jar:1.5.0 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.352 s
[INFO] Finished at: 2016-07-01T11:16:12+05:00
[INFO] Final Memory: 17M/226M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project Scripts: Could not resolve dependencies for project com.ublox.jira.plugins:Scripts:atlassian-plugin:1.0.0-SNAPSHOT: Failure to find com.googlecode:jira-suite-utilities:jar:1.5.0 in https://maven.atlassian.com
/repository/public was cached in the local repository, resolution will not be reattempted until the update interval of atlassian-public has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
Petar Petrov (Appfire)
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.
June 30, 2016

And in which repository do you have the jira-suite-utilities jar?

Tayyab Bashir
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.
June 30, 2016

I don't have it anywhere, I'm trying to pick it from the URL mentioned in repo tag. 
I found its info from here: https://www.versioneye.com/java/com.googlecode:jira-suite-utilities/1.5.0#code_snippet 

Is it possible that I can just keep the jira-suite jar file inside my plugin's folder, and call it somehow through pom for resolving dependency?  

Petar Petrov (Appfire)
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.
June 30, 2016

That data is obsolete, as I told you in your other question, JSU is not hosted on the Atlassian maven repos. In you other question I explained how to depend on a jar without it being present in a maven repository - please check that.

Tayyab Bashir
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.
June 30, 2016

I tried as you suggested, and it did work. 
However it does depend on Maven. I downloaded the jar file and ran couple of commands to install the jar in my local maven.

The reason why I don't want to do this is because I have to upload the source somewhere, and if someone downloads the source and tries to build it, It will fail since they won't have installed the jar files manually into their maven as I had done to run my plugin.


Is there some way I could place the jira-suite jar in one of my plugin's folder and call it into POM while compiling it?

Petar Petrov (Appfire)
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.
July 1, 2016

I was referring to the link which I sent you on how to depend on a jar which is included in the maven project structure. I'll post it here again for reference: http://stackoverflow.com/questions/364114/can-i-add-jars-to-maven-2-build-classpath-without-installing-them?lq=1. This post contains very good summary of the different solutions.

Tayyab Bashir
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.
July 1, 2016

I've solved the problem by using system approach. 
I used "system" as the scope of the dependency and gave the jar location in systemPath.

Thanks for your help.  

Petar Petrov (Appfire)
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.
July 1, 2016

OK, but make sure you read carefully the drawbacks of this approach.

 

TAGS
AUG Leaders

Atlassian Community Events