32

I updated the gradle version to the 7.0.4 (com.android.tools.build:gradle:7.0.4)

And now in some of my modules I am solving the problem with maven.

So i replace apply plugin: 'maven' on apply plugin: 'maven-publish'

But I don't understand how to rewrite this section of code correctly:

uploadArchives {
 repositories {
 mavenDeployer {
 repository(url: uri("${rootProject.projectDir}/maven-repo"))
 }
 }
}
uploadArchives.dependsOn sourcesJar

Because when I start, I get the following error:

Could not find method uploadArchives() for arguments [build_ejkqjjnby5fggiavovparsecy$_run_closure5@c0f0c25] on project ':authenticator_sdk' of type org.gradle.api.Project

asked Jan 3, 2022 at 11:26

2 Answers 2

52

After I have read the documentation in more detail here and here,

I was able to rewrite my problematic code section as follows:

publishing {
 repositories {
 maven {
 url = uri("${rootProject.projectDir}/maven-repo")
 }
 }
}
answered Jan 4, 2022 at 12:36
Sign up to request clarification or add additional context in comments.

5 Comments

where do I add these lines?
@JohhanSantana in yours build.gradle(to the bottom).
repositories.mavenDeployer { // Deploy to react-native-event-bridge/maven, ready to publish to npm repository url: "file://${projectDir}/../android/maven" configureReactNativePom pom }
Above is the code how we can modify that and i which line we should do a change. Should we use the 'maven' or 'maven-publish' . Please guide I did't understand
use 'maven-publish' and replace uploadArchives code with above one helped me.
0

I have got the error when I am bumping some old gradle project on 6.. to 7.4.*. So renaming uploadArchives to publishing helped me. Also I got other error where old code was referring to compile and testCompile but I learned that those need to be chged as "compile" --> "implementation" and "testCompile" --> "testImplementation" under dependencies. After these changes my build is successful. I hope this helps.

answered Aug 10, 2022 at 3:57

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.