Reputation: 11
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:
gradle build
in cmd in a PC connected to the Internet,finish downloading dependency files and building the project successfully.modified build.gradle
apply plugin: 'maven'
uploadArchives{
repositories{
mavenDeployer{
repository(url: "http://localhost:8081/artifactory/libs-snapshot-local"){
authentication(userName: 'admin', password: 'password')
}
}
}
}
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
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