Reputation: 5480
I performed mvn clean install
on a Java project which I wish to use as part of my Android project.
If I was using maven
, I would do:
<dependency>
<groupId>com.abc.project</groupId>
<artifactId>my-work-sdk</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
But since I'm using gradle, I tried doing:
compile group: 'com.abc.project', name: 'my-work-sdk', version: '2.0.0-SNAPSHOT'
But I get:
Error: Failed to resolve: com.abc.project:my-work-sdk:2.0.0-SNAPSHOT
I have added mavenLocal()
as a repository to the root-level build.gradle
file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Upvotes: 3
Views: 4437
Reputation: 4121
These are the steps I think you need to take from your comments:
mvn install
your my-work-sdk
project.In your gradle build.gradle project, add the mavenLocal repository:
repositories {
mavenLocal()
}
If this is a multi project build, and you want the mavenLocal() repository to be accessible by all subprojects, as well as the root project, it should go under allProjects
like so:
allProjects {
repositories {
mavenLocal()
}
}
Alternatively, if you only want the mavenLocal
repo to be accessible from the subprojects, you can replace allProjects
with subprojects
.
This should be all you need to do.
Upvotes: 2
Reputation: 9687
You have to explicitly set Maven local as Gradle repository:
repositories {
mavenLocal()
}
If it is used in buildscript:
buildscript {
repositories {
mavenLocal()
}
}
Upvotes: 2