How to set a new jar as dependency by creating local repository


(Subhasis Mishra Sharma) #1

Hi,

I am trying to use a custom jar file as a dependency to my project. Where it seems I am unable to point to the local repository properly.

Below are the steps I am following,

Step-1 : #export CUSTOM_LIBRARY_PATH=/Users/Repo on my CentOs terminal. Where putting the jar file jclouds-scriptbuilder-1.0.0-sources.jar .
Step-2 : Creating a file gradle/alt-repo.gradle and adding,
repositories.ext.altRepo = {
if (System.getenv(‘CUSTOM_LIBRARY_PATH’)) {
repositories.maven { url “file://${System.getenv(‘CUSTOM_LIBRARY_PATH’)}” }
}
}
project.buildscript.repositories.ext.altRepo = {
if (System.getenv(‘CUSTOM_LIBRARY_PATH’)) {
project.buildscript.repositories.maven { url “file://${System.getenv(‘CUSTOM_LIBRARY_PATH’)}” }
}
}

Step-3 : In my build.gradle adding,

buildscript {
apply from: "$rootDir/gradle/alt-repo.gradle"
repositories {
altRepo()
}
dependencies {
classpath files(‘jclouds-scriptbuilder-1.0.0-sources.jar’)
}
}

plugins {
id ‘jclouds-scriptbuilder’ version ‘1.0.0’
}
apply plugin: ‘jclouds-scriptbuilder’

While trying to build getting following exception.

FAILURE: Build failed with an exception.

*** Where:**
Build file ‘/root/NetBeansProjects/openbaton/dummy-vnfm-amqp/build.gradle’ line: 39

*** What went wrong:**
Plugin [id: ‘jclouds-scriptbuilder’, version: ‘1.0.0’] was not found in any of the following sources:

- Gradle Core Plugins (not a core plugin, please see http://gradle.org/docs/2.4/userguide/standard_plugins.html for available core plugins)
- Gradle Central Plugin Repository (no ‘jclouds-scriptbuilder’ plugin available - see https://plugins.gradle.org for available plugins)

*** Try:**
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Please someone suggest what I need to do to build successfully.