Need to upload contents to artifactory from Maven

(Vivek.P) #1

I am not able to upload log4j maven component to our Artifactory
can you please tell what is wrong with this build.gradle file ?

apply from: “D:/JavaProjects/Bootstrap/GradleBuildScripts/common.gradle”
apply plugin: ‘base’

repositories {
maven {
name ‘maven-main’
url “${repositoryServer}/repo1-cache”
credentials {
username artifactoryUser
password artifactoryPassword
}
}
}

configurations {
deps
}

dependencies {
deps group: ‘org.apache.logging.log4j’, name: ‘log4j-core’, version: ‘2.11.2’
// deps group:‘org.apache.logging.log4j’, name: ‘log4j-1.2-api’, version: ‘2.11.2’
// https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core
//compile group: ‘org.apache.logging.log4j’, name: ‘log4j-core’, version: ‘2.11.2’
deps group: ‘org.apache.logging.log4j’, name: ‘log4j-api’, version: ‘2.11.2’
deps group: ‘org.apache.logging.log4j’, name: ‘log4j-core’, version: ‘2.11.2’
}

task download {
doLast {
configurations.deps.files
}
}

Error snapshot:

D:\scripts\Java_Gradle\ManuallyBuiltComponents-gradle\log4j>gradle download
Starting a Gradle Daemon (subsequent builds will be faster)

Task :download FAILED

FAILURE: Build failed with an exception.

  • Where:
    Build file ‘D:\scripts\Java_Gradle\ManuallyBuiltComponents-gradle\log4j\build.gradle’ line: 30

Could not resolve all files for configuration ‘:deps’.

Could not find org.apache.logging.log4j:log4j-core:2.11.2.
Searched in the following locations:
- https://inblrkisnw2292.ad005.onehc.net:8082/artifactory/prebuilts/org.apache.logging.log4j/log4j-core/2.11.2/ivy-2.11.2.xml
- https://inblrkisnw2292.ad005.onehc.net:8082/artifactory/prebuilts/org.apache.logging.log4j/log4j-core/2.11.2/log4j-core.jar
- https://inblrkisnw2292.ad005.onehc.net:8082/artifactory/product-staging/org.apache.logging.log4j/log4j-core/2.11.2/ivy-2.11.2.xml
- https://inblrkisnw2292.ad005.onehc.net:8082/artifactory/product-staging/org.apache.logging.log4j/log4j-core/2.11.2/log4j-core.jar
- https://inblrkisnw2292.ad005.onehc.net:8082/artifactory/tools/org.apache.logging.log4j/log4j-core/2.11.2/ivy-2.11.2.xml
- https://inblrkisnw2292.ad005.onehc.net:8082/artifactory/tools/org.apache.logging.log4j/log4j-core/2.11.2/log4j-core.jar
- https://inblrkisnw2292.ad005.onehc.net:8082/artifactory/repo1-cache/org/apache/logging/log4j/log4j-core/2.11.2/log4j-core-2.11.2.pom
- https://inblrkisnw2292.ad005.onehc.net:8082/artifactory/repo1-cache/org/apache/logging/log4j/log4j-core/2.11.2/log4j-core-2.11.2.jar
Required by:
project :

  • What went wrong:
    Execution failed for task ‘:download’.

Could not resolve all files for configuration ‘:deps’.
Could not find org.apache.logging.log4j:log4j-core:2.11.2.
Searched in the following locations:
-

(LingoCoder) #2

Please share with us the following important details:

  1. Please share with us the reason you are calling a task named „download“, when you say you want to upload something?
  2. Please share with us your upload task — if you have one?
  3. Please share with us the exact same results that you get when you copy and paste https://inblrkisnw2292.ad005.onehc.net:8082/artifactory/repo1-cache/org/apache/logging/log4j/log4j-core/ into your browser?
(Vivek.P) #3

Thanks for your reply.
1.
I guess we can define that name !! we just mentioned it as download.

task hello {
    doLast {
        println 'Hello world!'
    }
}

We just want to push this version of log4j
https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-api/2.11.2/log4j-api-2.11.2.jar
https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-api/2.11.2/

from maven to artifactory. how can we do it ?
for pushing the log4j we tried giving the line mentioned below. But its not working .
deps group: ‘org.apache.logging.log4j’, name: ‘log4j-core’, version: ‘2.11.2’

if you can tell me the correct way of doing it that would be helpful.

This is the message i get when i try to access that path

{
“errors” : [ {
“status” : 404,
“message” : “Item repo1-cache:org/apache/logging/log4j/log4j-core does not exist”
} ]
}

(LingoCoder) #4

I’ve never done whatever it is you’re trying to do before either. I can’t help you. Sorry :disappointed:

(Vivek.P) #5

Hi lingocoder,

It worked :slight_smile: . The issue was with this URL
url “${repositoryServer}/repo1-cache”
I changed it to
url “${repositoryServer}/repo1”

Thanks for your reply

Gradle Build Error .. Need help
(LingoCoder) #6

You’re welcome :+1: Thanks for getting back :slight_smile: