2016-04-05 18 views
1

Özel bir maven repo bir Grails eklentisi (sonuçta bir .jar) yayımlamak üzerinde çalışıyorum aşağıdaki hatayla sonuçlanır. Kimlik bilgilerinin geçerli olduğunu birçok kez doğruladım.Yayımlama .jar için özel maven ile Gradle

bilgilerinin, tüm (Yetkisiz 401) gönderilir edilmiyor gibi görünüyor:

Ben (sadece ilgili bölümleri) aşağıdakilere sahip benim build.gradle olarak
Could not transfer artifact com.blah.plugins:blahCommonPlugin:pom:0.1 from/to remote (http://maven.blah.com): Could not write to resource 'com/blah/plugins/blahCommonPlugin/0.1/blahCommonPlugin-0.1.pom' 
:publishMavenJavaPublicationToBlahRepository FAILED 
:publishMavenJavaPublicationToBlahRepository (Thread[Daemon worker,5,main]) completed. Took 2.788 secs. 

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':publishMavenJavaPublicationToBlahRepository'. 
> Failed to publish publication 'mavenJava' to repository 'blah' 
    > Failed to deploy artifacts: Could not transfer artifact com.blah.plugins:blahCommonPlugin:jar:0.1 from/to remote (http://maven.blah.com): Could not write to resource 'com/blah/plugins/blahCommonPlugin/0.1/blahCommonPlugin-0.1.jar' 

* Try: 
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. 

BUILD FAILED 

Total time: 5.634 secs 
Stopped 0 compiler daemon(s). 
Could not PUT 'http://maven.blah.com/com/blah/plugins/blahCommonPlugin/0.1/blahCommonPlugin-0.1.jar'. Received status code 401 from server: Unauthorized 

:

version "0.1" 
group "com.blah.plugins" 

publishing { 
    publications { 
     mavenJava(MavenPublication) { 
      from components.java 
     } 
    } 

    repositories { 
     maven { 
      name "blah" 
      url "http://maven.blah.com" 
     } 
    } 
} 

//Not sure if I need this 
grailsPublish { 
    repo = 'blah' 
    githubSlug = 'blah/blahCommonPlugin' 
    title = "blahCommonPlugin" 
    desc = "blahcommon plugin" 
    developers = [erikahlswede:"Erik Ahlswede"] 
} 

Sonra benim settings.xml bu var (~/.m2/settings.xml)

<settings> 
    <servers> 
    <server> 
     <id>blah</id> 
     <username>un</username> 
     <password>pass</password> 
    </server> 
    </servers> 
</settings> 

Neyi kaçırdığımı biliyor musun? 1

DÜZENLEME şimdilik hata ayıklamak için settings.xml kaldırıldı.

repositories { 
     maven { 
      name "snapshots" 
      url "http://maven.blah.com/" 
      credentials { 
       username 'blahUser' 
       password 'blahPassword' 
      } 
      authentication { 
       basic(BasicAuthentication) 
       digest(DigestAuthentication) 
      } 
     } 
} 

Ve ayrıntılı çıkışı ile görüyorum: Ben kullanıyorum

Publishing to repository org.gradle.api.internal.[email protected]457d1e38 
Using Credentials [username: blahUser] for authenticating against 'null:-1' using Digest 
Using Credentials [username: blahUser] for authenticating against 'null:-1' using Basic 
Deploying to http://maven.blah.com/ 
Downloading: com/blah/plugins/blahCommonPlugin/0.1-SNAPSHOT/maven-metadata.xml from repository remote at http://maven.blah.com/ 
Constructing external resource: http://maven.blah.com/com/blah/plugins/blahCommonPlugin/0.1-SNAPSHOT/maven-metadata.xml 
Performing HTTP GET: http://maven.blah.com/com/blah/plugins/blahCommonPlugin/0.1-SNAPSHOT/maven-metadata.xml 
Connection request: [route: {}->http://maven.blah.com][total kept alive: 0; route allocated: 0 of 5; total allocated: 0 of 10] 
Connection leased: [id: 0][route: {}->http://maven.blah.com][total kept alive: 0; route allocated: 1 of 5; total allocated: 1 of 10] 
Connecting to maven.blah.com:80 
CookieSpec selected: best-match 
Auth cache not set in the context 
Target auth state: UNCHALLENGED 
Proxy auth state: UNCHALLENGED 
Attempt 1 to execute request 
Sending request: GET /com/blah/plugins/blahCommonPlugin/0.1-SNAPSHOT/maven-metadata.xml HTTP/1.1 
Receiving response: HTTP/1.1 404 Not Found 
Connection can be kept alive indefinitely 
Connection [id: 0][route: {}->http://maven.blah.com] can be kept alive indefinitely 
Connection released: [id: 0][route: {}->http://maven.blah.com][total kept alive: 1; route allocated: 1 of 5; total allocated: 1 of 10] 
Resource missing. [HTTP GET: http://maven.blah.com/com/blah/plugins/blahCommonPlugin/0.1-SNAPSHOT/maven-metadata.xml] 
Could not find metadata com.blah.plugins:blahCommonPlugin:0.1-SNAPSHOT/maven-metadata.xml in remote (http://maven.blah.com/) 
Uploading: com/blah/plugins/blahCommonPlugin/0.1-SNAPSHOT/blahCommonPlugin-0.1-20160405.174228-1.jar to repository remote at http://maven.blah.com/ 
Attempting to put resource http://maven.blah.com/com/blah/plugins/blahCommonPlugin/0.1-SNAPSHOT/blahCommonPlugin-0.1-20160405.174228-1.jar. 
Upload http://maven.blah.com/com/blah/plugins/blahCommonPlugin/0.1-SNAPSHOT/blahCommonPlugin-0.1-20160405.174228-1.jar 
Performing HTTP PUT: http://maven.blah.com/com/blah/plugins/blahCommonPlugin/0.1-SNAPSHOT/blahCommonPlugin-0.1-20160405.174228-1.jar 
Connection request: [route: {}->http://maven.blah.com][total kept alive: 1; route allocated: 1 of 5; total allocated: 1 of 10] 
Connection leased: [id: 0][route: {}->http://maven.blah.com][total kept alive: 0; route allocated: 1 of 5; total allocated: 1 of 10] 
Stale connection check 
CookieSpec selected: best-match 
Auth cache not set in the context 
Target auth state: UNCHALLENGED 
Proxy auth state: UNCHALLENGED 
Attempt 1 to execute request 
Sending request: PUT /com/blah/plugins/blahCommonPlugin/0.1-SNAPSHOT/blahCommonPlugin-0.1-20160405.174228-1.jar HTTP/1.1 
Receiving response: HTTP/1.1 401 Unauthorized 
Connection can be kept alive indefinitely 
Authentication required 
maven.blah.com:80 requested authentication 
Authorization challenge processed 
Authentication failed 

DÜZENLEME 2

çalıştı: Burada

Using Credentials [username: blahUser] for authenticating against 'null:-1' using Digest 
Using Credentials [username: blahUser] for authenticating against 'null:-1' using Basic 

ilgili log geri kalanı Sadece isteği kıvırmak işe yaramıyor:

$ curl --basic -u username:password http://maven.blah.com/com/blah/plugins/blahCommonPlugin/test/api-1.0-20160128.114425-1.jar --request PUT --data blahCommonPlugin-0.1-SNAPSHOT.jar 
<html> 
<head><title>401 Authorization Required</title></head> 
<body bgcolor="white"> 
<center><h1>401 Authorization Required</h1></center> 
<hr><center>nginx/1.6.3</center> 
</body> 
</html> 

Maven sunucumuzun nginx yapılandırmasını buldum. Bunun doğru şekilde yapılandırıldığından emin değil. Bu iyi görünüyor mu ?:

# Allow only these methods (GET and HEAD are allowed by default) 
dav_methods PUT MKCOL; 
dav_access user:rw group:rw all:r; 
create_full_put_path on; 
... 
# For all plugins and directories 
location/{ 
    # Allow files listing for repositories 
    autoindex on; 

    limit_except PUT MKCOL { 
     # For GET and HEAD request use this file for username/password who have only download permissions from Maven server 
     auth_basic_user_file /etc/nginx/.htpasswd/downloaders; 
    } 
} 
+0

O 'gradle benziyor 'kimlik bilgileri için ayar yapmıyor. Bu ayarın kullanıcı adı/şifresi nasıl kullanıldığından eminsiniz? – Armaiti

+0

Eklenen EDIT 1. Verbose günlükleri "Temel" kullanarak "null: -1" karşı kimlik doğrulaması için [kullanici adi: blahUser] kullanma " –

cevap

1

Biz kimlik bilgileriyle repo maven için yayıncılık ele nasıl olduğunu:

apply plugin: 'maven' 

uploadArchives { 
    repositories { 
     mavenDeployer { 
      repository(url: "http://repo"){ 
       authentication(userName: "yankee", password: "doodle") 
      } 
      snapshotRepository(url: "http://repo-snapshotRepository"){ 
       authentication(userName: "yankee", password: "doodle") 
      } 
     } 
    } 
} 

Daha detay burada bulunabilir: https://docs.gradle.org/current/userguide/maven_plugin.html

+0

Aslında, kimlik doğrulaması başarısız olduğu için aslında PUT istekleri için ayrı bir kullanıcı var. Umarım her şey yolunda, D –

İlgili konular