mschonaker / wagon-git

Git Wagon for Apache Maven
http://synergian.github.io/wagon-git/
83 stars 31 forks source link

How to use with maven-publish plugin ? #61

Open devsideal opened 2 years ago

devsideal commented 2 years ago

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://git@bitbucket.org:<org-name>/<repo-name>.git')
        snapshotRepository(url: "git:snapshots://https://YOUR_USERNAME:YOUR_APP_PASSWORD@bitbucket.org/YOUR_COMPANY/repo-snapshot.git")
        pom.project {
            groupId = "com.it.validator"
            version = "0.0.1"
            artifactId = "ev"
            packaging "aar"
        }
    }
  }
faheemriaz-eng commented 2 years ago

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

aljazerzen commented 2 years ago

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