Shimima
Shimima

Reputation: 11

How to upload dependencies to a artifactory server

I'm a freshman here,and I'd like to ask a question about dependency in deploying a gradle project.

I've got an offline developing environment,so when I try a spring sample built by gradle,i try the artifactory in order to resolve dependencies.

Here's what I've done:

  1. deploy gradle,download project spring-integration-kafka-master and rungradle build in cmd in a PC connected to the Internet,finish downloading dependency files and building the project successfully.
  2. deploy artifactory(oss 4.3.2) and run it,sucessfully login the local web page
  3. modified build.gradle

    apply plugin: 'maven'
    uploadArchives{
        repositories{
            mavenDeployer{
                repository(url: "http://localhost:8081/artifactory/libs-snapshot-local"){
                    authentication(userName: 'admin', password: 'password')
                }
            }
        }
    }
    
  4. run gradle uploadArchives

Actually it works,but the artifactory got BUILD-SNAPSHOT like this artifactory web page screenshot which I cannot resolve my dependencies in another offline computer(I export the repository and import it to artifactory in the offline computer).

There might be some misunderstandings of dependency or gradle concepts,I hope you can help me out.

Sincerely,shimima

Upvotes: 1

Views: 2436

Answers (1)

JBaruch
JBaruch

Reputation: 22893

If you already have 2 Artifactory instances running, put one in your "durty" environment, and configure Gradle to resolve dependencies from it. It will cache the dependencies that you need automatically.

Then, by using replication (or export–import) transfer the artifacts to the other Artifactory instance, than runs in the "clean" environment and configure your internal Gradle users to resolve from this internal instance.

Upvotes: 2

Related Questions