wagon-git icon indicating copy to clipboard operation
wagon-git copied to clipboard

How to use with maven-publish plugin ?

Open devsideal opened this issue 3 years ago • 2 comments

I want to publish my android library on Bitbucket, But as i found in gradle version 7.x maven plugin has removed and now we need to use maven-publish instead, So how we can migrate below script to make workable with maven-publish plugin:

 uploadArchives {
        configuration = configurations.deployLibrary
        repositories.mavenDeployer {
        repository(url: 'git:master://[email protected]:<org-name>/<repo-name>.git')
        snapshotRepository(url: "git:snapshots://https://YOUR_USERNAME:[email protected]/YOUR_COMPANY/repo-snapshot.git")
        pom.project {
            groupId = "com.it.validator"
            version = "0.0.1"
            artifactId = "ev"
            packaging "aar"
        }
    }
  }

devsideal avatar Mar 07 '22 12:03 devsideal

@devsideal I am facing the same challenge are you able to find any solution?

faheemriaz-eng avatar Apr 14 '22 08:04 faheemriaz-eng

I don't think this is possible any more, see this comment: https://github.com/gradle/gradle/issues/14750#issuecomment-784358228

TLDR; maven-publish does not use wagon anymore

I ended up writing a shell script that clones the repo, runs gradle to publish into that repo and then commit & push:

#!/bin/bash

if [ ! -d maven-repo ]; then
  git clone <your url>
fi

cd maven-repo
git pull
cd ..

./gradlew publish

cd maven-repo

git add .
git commit -m "deploy <name of your project>"
git push

An arguably better alternative would be to stick with gradle<=6

aljazerzen avatar Jun 21 '22 14:06 aljazerzen