0

Nginx server setup on ubuntu works fine, I can access the index.html page. I add below config to use this nginx server as maven repository:

server {
listen 80 default_server;
listen [::]:80 default_server;

root /var/www/html;
index index.html index.htm index.nginx-debian.html;

server_name _;

location / {
        dav_methods  PUT DELETE MKCOL COPY MOVE;
        create_full_put_path  on;
        dav_access  user:rw group:rw all:r;

        auth_basic "Restricted Content";
        auth_basic_user_file /etc/nginx/.htpasswd;
}

But when I run gradle 4.4.1 publish command, I got below error:

* What went wrong:
Execution failed for task ':publishJarAppPublicationToMyRepoRepository'.
> Failed to publish publication 'jarApp' to repository 'MyRepo'
   > Failed to deploy artifacts/metadata: Cannot access http://localhost/repository with type default using the available connector factories: BasicRepositoryConnectorFactory

publish.gradle file:

apply plugin: "maven-publish"

publishing {
    repositories {
        maven {
            name 'MyRepo'
            url "http://localhost/repository"
            credentials {
                username = "myusername"
                password = "mypassword"
            }
        }
    }
    publications {
        jarApp(MavenPublication) {
            groupId "com.sample.package"
            artifactId "Sample"
            version "1.0"
            artifact ("sample.jar")
        }
    }
}

Since I can access the page! and I can use curl command to upload file to repository, so server should be fine but maybe config from gradle not correct!

lucky1928
  • 8,708
  • 10
  • 43
  • 92

0 Answers0