0

I want to use an external folder as a library. That folder(mvnLib) has maven-metadata-local.xml and a .pom and a .aar files in it and documentation says I can use it like this:

allprojects { 
  repositories {
​     maven {
      url "../mvnLib"
     }
  } 
}

But id doesnt work and I get this error:

Could not find method ​implementation() for arguments [com.app.two:plib:1.3.2] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

I cant find this type of Maven repository documentation. Can I use a Maven repository on disk? Is this correct? Why Im getting this error? Is there a automatic procedure to adding libraries like this to lower error rate?

Update:

mvnLib folder structure is:

[Project Root]
.gradle
app
mvnLib
   com
     app
        two
           plib
              1.3.2
                   prlib-1.3.2.pom
                   prlib-1.3.2.aar
              maven-metadata-local.xml

Documentation says put the mvnLib in the root of project. then on the project level build.gradle:

allprojects { 
  repositories {
​     maven {
      url "../mvnLib"
     }
  } 
}

Then on the app level build.gradle:

implementation 'com.app.two:plib:1.3.2'

I do all of these but i get that error.

Fcoder
  • 8,466
  • 17
  • 54
  • 90

2 Answers2

1

You can define directories as Maven repositories as long as they fit the structure (comparable to the local repository). This is described here: https://stackoverflow.com/a/28762617/927493 .

J Fabian Meier
  • 26,766
  • 8
  • 52
  • 98
  • Thanks to you answer. But I cant get it. That repository created already. It has own .pom file. I updated my question. – Fcoder Feb 26 '19 at 08:17
  • Maybe it's a problem with how you write the url in your `build.gradle` (starting with `file://` or not). – J Fabian Meier Feb 26 '19 at 08:39
  • I tested everything but result is the same. My mvnLib folder is in the project root, and build.gradle file too. is this correct to refer library like url "../mvnLib"? I tested every model possible, but not succeed. As i know, all of problem is about path. if I remove that part from project build.gradle i get the same error – Fcoder Feb 26 '19 at 08:47
0

The error has nothing to do with the repository declaration. It complains about the dependency declaration and the fact that implementation is not known.

Did you add the java or java-library plugin to your project? Or another plugin for doing JVM based development? If you did not, then the error is expected, it just means that a configuration named implementation was not added to the project.

Louis Jacomet
  • 11,574
  • 2
  • 27
  • 36