Maven-publish Authentication failure


(Pooja Daryani) #1

Hello All:

We are using “maven-publish” plugin to upload artifact to our artifactory.

However, we are getting error
Could not transfer artifact com.ivr:regivr.top:war:0117.1 from/to remote (https://example.com/artifactory/ccivr-bld): Could not write to resource ‘com/ivr/regivr.top/0117.1/regivr.top-0117.1.war’

Below is the snippet of our build script. The user has read and write access on the artifactory. I have also included stacktrace.

apply plugin: 'maven-publish'

System.setProperty('javax.net.ssl.trustStore', 'xxx')
System.setProperty('javax.net.ssl.trustStorePassword', 'xxx')
repositories {
    
    maven { 
			name 'ccivr-bld'
			url "https://example.com/artifactory/ccivr-bld"
			credentials {
				username  'myUserName'
				password  'myPassword'
			}
			authentication {
				basic(BasicAuthentication)
			}
		}
    
    
}

task publishArtifacts(type: PublishToMavenRepository, 
					  group: 'MyCompnay',
					  description: 'Publish artifacts to Artifactory') {	
	
		publishing.publications.create('ivrProjectArtifacts', MavenPublication) {
			groupId = 'com.ivr'
			artifactId = 'regivr.top'
			version='0117.1'
			artifacts=["./release/regivr.top-0117.1.war"]
		}
		publication = publishing.publications.findByName 'ivrProjectArtifacts'
		repository = repositories.findByName 'ccivr-bld'
		
			
}

StackTrace:

12:35:18.479 [INFO] [org.gradle.api.publish.maven.internal.publisher.AbstractMavenPublisher] Publishing to repository org.gradle.api.internal.artifacts.repositories.DefaultMavenArtifactRep
itory_Decorated@2aa62fec
12:35:18.505 [INFO] [org.gradle.api.publication.maven.internal.action.MavenDeployAction] Deploying to https://example.com/artifactory/ccivr-bld
12:35:18.506 [INFO] [org.gradle.api.publication.maven.internal.action.LoggingMavenTransferListener] Uploading: com/ivr/regivr.top/0117.1/regivr.top-0117.1.war to repository remo
 at https://example.com/artifactory/ccivr-bld/
12:35:18.506 [DEBUG] [org.gradle.internal.resource.transport.DefaultExternalResourceRepository] Attempting to put resource https://example.com/artifactory/ccivr-bld/
m/wellsfargo/ivr/regivr.top/0117.1/regivr.top-0117.1.war.
12:35:18.506 [LIFECYCLE] [org.gradle.internal.resource.transfer.ProgressLoggingExternalResourceUploader] Upload https://example.com/artifactory/ccivr-bld/com/wellsfa
o/ivr/regivr.top/0117.1/regivr.top-0117.1.war
12:35:18.506 [DEBUG] [org.gradle.internal.resource.transport.http.HttpClientHelper] Performing HTTP PUT: https://example.com/artifactory/ccivr-bld/com/ivr
egivr.top/0117.1/regivr.top-0117.1.war
12:35:18.506 [DEBUG] [org.gradle.internal.resource.transport.http.HttpClientConfigurer] Using Credentials [username: myUserName] for authenticating against 'null:-1' using Basic
12:35:18.507 [DEBUG] [org.apache.http.client.protocol.RequestAddCookies] CookieSpec selected: default
12:35:18.507 [DEBUG] [org.apache.http.client.protocol.RequestAuthCache] Auth cache not set in the context
12:35:18.507 [DEBUG] [org.apache.http.impl.conn.PoolingHttpClientConnectionManager] Connection request: [route: {s}->https://example.com:443][total kept alive: 0; ro
e allocated: 0 of 2; total allocated: 0 of 20]
12:35:18.507 [DEBUG] [org.apache.http.impl.conn.PoolingHttpClientConnectionManager] Connection leased: [id: 6][route: {s}->https://example.com:443][total kept alive:
; route allocated: 1 of 2; total allocated: 1 of 20]
12:35:18.507 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Opening connection {s}->https://example.com:443
12:35:18.507 [DEBUG] [org.apache.http.impl.conn.DefaultHttpClientConnectionOperator] Connecting to example.com/10.33.218.10:443
12:35:18.507 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Connecting socket to example.com/10.33.218.10:443 with timeout 0
12:35:18.645 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Enabled protocols: [TLSv1, TLSv1.1, TLSv1.2]
12:35:18.646 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Enabled cipher suites:[TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_RSA_WI
_AES_128_CBC_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, TLS_ECDHE_ECDSA
ITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_
A, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256
TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
L_RSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, TLS_EMPTY_RENEG
IATION_INFO_SCSV]
12:35:18.646 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Starting handshake
12:35:18.787 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory] Secure session established
12:35:18.788 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory]  negotiated protocol: TLSv1.2
12:35:18.788 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory]  negotiated cipher suite: TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
12:35:18.788 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory]  peer principal: CN=example.com, OU=Common Channel Infrastructure, O=My Company, C=US
12:35:18.788 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory]  peer alternative names: [example.com]
12:35:18.788 [DEBUG] [org.apache.http.conn.ssl.SSLConnectionSocketFactory]  issuer principal: CN=My Company Enterprise Certification Authority 05 G2, OU=My CompanyCertification Authorit
s, O=My Company, C=US
12:35:18.788 [DEBUG] [org.apache.http.impl.conn.DefaultHttpClientConnectionOperator] Connection established 172.30.9.167:58610<->10.33.218.10:443
12:35:18.788 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Executing request PUT /artifactory/ccivr-bld/com/ivr/regivr.top/0117.1/regivr.top-0117.1.war HTTP/1.1
12:35:18.788 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Target auth state: UNCHALLENGED
12:35:18.788 [DEBUG] [org.apache.http.impl.execchain.MainClientExec] Proxy auth state: UNCHALLENGED
12:35:20.793 [DEBUG] [org.apache.http.impl.auth.HttpAuthenticator] Authentication required
12:35:20.793 [DEBUG] [org.apache.http.impl.auth.HttpAuthenticator] example.com:443 requested authentication
12:35:20.793 [DEBUG] [org.apache.http.impl.auth.HttpAuthenticator] Authorization challenge processed
12:35:20.793 [DEBUG] [org.apache.http.impl.auth.HttpAuthenticator] Authentication failed
12:35:20.794 [DEBUG] [org.apache.http.impl.conn.DefaultManagedHttpClientConnection] http-outgoing-6: Shutdown connection

SOLUTION

username to connect to repository was lowercase and password has to be enrypted

Thanks,
Pooja


(Chris Doré) #2

How come you’re creating your own task manually instead of letting the maven-publish plugin create the tasks for you? I’m just curious about your use case for doing so.