How to Upload an Item to Path of Building
Respond i (will cover ii too in a different sense): Using Artifactory "Antiquity Bundle" feature section under "Deploy" tab can do the TRICK for AT Least uploading the artifacts in a style we want, by creating a nix file first (containing the structure and artifacts in it) --OR you lot can upload the artifacts using/calling Artifactory Residue API way.
Loftier level idea:
Create a zip file chosen gigaproject.zip OR anyname.zippo/.tar/compressed file which Artifactory can read. Within the zip, create the structure - how these artifacts will be loaded to Artifactory
i.east. gigaproject.nada will incorporate the following folders/structure/files.
Instance 1:
com/company/project/gigaproject/nine.8.0/linux/gigainstall com/company/project/gigaproject/9.eight.0/solaris/gigainstall com/company/project/gigaproject/9.8.0/win32/gigainstall.exe com/company/project/gigaproject/9.8.0/gigafile.dtd com/company/project/gigaproject/9.8.0/gigaanotherfile.dtd com/visitor/project/gigaproject/9.8.0/giga.jar com/company/project/gigaproject/9.8.0/giga.war
Notation: In case one case, I didn't utilize any -ten.10.10 in the filename (i.e. I'm using plain and simple giga.jar instead of giga-9.8.0.jar).
The above Upload/Deploy volition result the files (equally shown in the following snapshot):
So, nosotros have accomplished what we wanted. Really (visibly speaking yes), but not in a way Artifactory usually stores these artifacts (as they should -x.10.x version embedded in the file name and where antiquity id should match the artifact filename). Now, if you want to consume the following in a Gradle build file, yous CANNOT as first, y'all haven't uploaded the filename with -x.10.ten version name in it, secondly, the antiquity id in our case ane tree was "gigaproject" (after com/company/projection folder), and then Gradle style of defining what artifact id and what artifact file name you want won't piece of work.
compile 'com.visitor.project:gigaproject:CANNOTSAY_HOW_TO_GET_GIGA_JARorGIGAINSTALL_with_without_extension'
Conclusion: It's possible to upload whatever files (with/without extension in Artifactory) in any structure just it depends how your build system will consume it or will be able to consume it or not. - I deleted the structure I just created with case 1 .null file from Artifactory repository to try adjacent case#2 and deleted the .zip file I created.
Case 2:
Permit'south create an private versioned file proper name for each antiquity and also create structure in the format - how Artifactory actually stores them (an artifact as seen in a repository in a tree view) and create a .zip file containing that structure. Let'due south use the aforementioned "Antiquity Bundle" feature to upload this .zip file to upload individual artifacts that we demand in Artifactory - where artifact-id (2nd value which nosotros mention while trying to swallow information technology) would match the artifactfile name in Artifactory.
Folder/file construction for the .null file:
com/company/project/gigainstall/9.8.0/gigainstall-9.8.0.linux com/company/project/gigainstall/9.8.0/gigainstall-9.8.0.solaris com/company/project/gigainstall/9.viii.0/gigainstall-nine.8.0.exe com/company/project/gigafile/9.8.0/gigafile-9.8.0.dtd com/company/project/gigaanotherfile/ix.8.0/gigaanotherfile-9.viii.0.dtd com/company/project/giga/nine.8.0/giga-9.8.0.jar com/company/projection/giga/9.eight.0/giga-9.viii.0.war
NOTE: This time, nosotros'll be using the same "Artifact Parcel" feature and for similar files (gigainstall under both Linux/Solaris folders), I took the approach of creating gigainstall folder (containing gigainstall-nine.8.0.linux and gigainstall-ix.8.0.solaris file names) i.east. when we'll swallow these artifacts in Gradle under dependencies { ... } section for compile, we'll use x.x.10@ manner to fetch these artifacts from Artifactory.
OK, once "Antiquity Bundle" Deploy/Upload was successfully complete, I got the following message.
Successfully deployed vii artifacts from archive: gigaproject.zip (one seconds).
Now, allow'south meet how it looks like in Artifactory while searching for one of the antiquity/in Tree view. You can come across nosotros take the files now in place, with filename-10.x.10.extension style so that I tin can consume them easily in Gradle.
In Gradle build file (build.gradle), I'll mention:
dependencies { compile "com.company.project:gigainstall:9.8.0@linux" compile "com.company.projection:gigainstall:9.8.0@solaris" compile "com.company.project:gigainstall:9.8.0@linux" compile "com.company.project:giga:ix.eight.0 compile "com.company.project:giga:9.8.0@state of war compile "com.company.project:gigafile:9.8.0@dtd compile "com.visitor.project:gigaanotherfile:nine.8.0@dtd }
OH OH!! - That didn't piece of work, encounter beneath for Gradle error. Why? - Artifactory Package upload/deploy characteristic uploads a nix file content what y'all have in the .zip but information technology DOES Not create a .pom file per artifact it deploys. Thus, making the Gradle build to fail. May be in Ant this might succeed. This occurred for each individual .jar/.war/.dtd/etc file. I'k merely showing one error example.
While doing gradle clean build
Could non resolve all dependencies for configuration ':compile'. > Could not resolve com.visitor.projection:gigafile:0.0.0. Required by: com.company.project:ABCProjectWhichConsumesGIGAProjectArtifacts:i.64.0 > Could non Become 'http://artifactoryserver:8081/artifactory/ext-snapshot-local/com/company/project/gigafile/0.0.0/gigafile-0.0.0.pom'. Received status code 409 from server: Conflict
Example 3: Permit's take a simple approach (workaround but will save a lot of hurting). Create gigaproject.zip file with the following construction, this approach takes - No x.x.x version value embedded in the individual artifact/filename in the folder/file construction. We volition employ "Single Artifact" approach (which volition create the .pom for gigaproject.zip file automatically during the upload/deploy process provided by Artifactory). You'll still be able to get gigainstall file without needing any extension to its proper noun using this arroyo. During the upload/deploy step, as you already take seen, you upload gigaproject.nil and artifactory will upload it to a given Target Repository as "gigaproject-10.x.x.zip" where x.x.x is 9.viii.0 in our example. Encounter the paradigm snapshot below.
gigaproject/linux/gigainstall gigaproject/solaris/gigainstall gigaproject/win32/gigainstall.exe gigaproject/gigafile.dtd gigaproject/gigaanotherfile.dtd gigaproject/gigaproject.nil gigaproject/giga.jar gigaproject/giga.war
At present, upload it in Artifactory using "Unmarried Artifact" characteristic. Click "Deploy Artifact" once you lot tweak the values for GroupId, ArtifactId, Version, etc.
Once this is uploaded. You'll see in the zip artifact in the target repository (I took a bad instance, usually this would be libs-snapshot-local or libs-release-local instead of ext-...), you'll be able to consume the ZIP antiquity directly in Graddle:
dependencies { // This is the just line we need at present. compile "com.company.project:gigaproject:9.8.0@zip" }
Once the .zippo is available to Gradle build system, now you can tell Gradle to unpack this .zip file somewhere in your build/workspace area where you tin can feed the actual(unpacked) files (gigainstall, .dtd, .jar, .war, etc.) to the build procedure/steps.
PS: Case# i and 2 would have worked for Emmet I judge.
Reply 2: If you accept uploaded a not-extensioned file in either way. Make sure y'all have manually created/uploaded its POM file equally well (i.eastward. if I uploaded gigainstall-9.8.0 as an antiquity under com/company/project/gigainstall/nine.8.0/gigainstall-ix.eight.0, so at the same level, I have to/should create it's POM file (see a unproblematic template .pom file for a custom jar antiquity or while uploading an extensioned file via "Unmarried Antiquity" deploy, you'll meet what POM Editor window shows y'all) and upload both and so that Gradle won't fault out maxim no POM conflict/error. Emmet might not need pom (I didn't bank check that).
Once it's there in Artifactory, the following line should work -- OR comment please if you find another fashion.
dependencies { // See nothing mentioned subsequently - x.x.10@ compile "com.company.package:gigainstall:nine.viii.0@" }
Source: https://stackoverflow.com/questions/24536706/how-to-upload-an-artifact-to-artifactory-consume-it-in-a-build-system-gradle
0 Response to "How to Upload an Item to Path of Building"
Post a Comment