Before gradle1.3, publishing artifacts uses uploadconfigurationname to publish
Declare that artifacts depends on usage
Build. gradle
artifacts { artifact
}
Statement.
Artifact generation: three methods can be used:
1. Use a defined task:
task myJar(type: Jar)artifacts { archives myJar}
2. Use a file:
def someFile = file(‘build/somefile.txt‘)artifacts { archives someFile}
3. customize an artifact
task myTask(type: MyTaskType) { destFile = file(‘build/somefile.txt‘)}artifacts { archives(myTask.destFile) { name ‘my-artifact‘ type ‘text‘ builtBy myTask }}Start upload:
repositories { flatDir { name "fileRepo" dirs "repo" }}uploadArchives { repositories { add project.repositories.fileRepo ivy { credentials { username "username" password "pw" } url "http://repo.mycompany.com" } }}
This uploadarchives is actually the uploadconfigurationname. Archives is the configurationname of artifacts in the preceding section.
Note: After gradle1.3, a new mechanism will be used to upload components. This will be discussed in the next article.