在Gradle1.3之前,Publishing artifacts是使用uploadConfigurationName来publish

build.gradle

artifacts {
    artifact
}

声明。

生成artifact:可以使用三种途径:

1、使用已定义的任务:

task myJar(type: Jar)
artifacts {
   archives myJar
}

2、使用一个file:

def someFile = file('build/somefile.txt')
artifacts {
  archives someFile
}

3、自定义一个artifact

task myTask(type: MyTaskType) {
  destFile = file('build/somefile.txt')
}
artifacts {
  archives(myTask.destFile) {
  name 'my-artifact'
  type 'text'
  builtBy myTask
  }
}

开始上传:

repositories {
 flatDir {
  name "fileRepo"
  dirs "repo"
  }
}
uploadArchives {
  repositories {
    add project.repositories.fileRepo
    ivy {
      credentials {
         username "username"
         password "pw"
       }
    url "http://repo.mycompany.com"
   }
  }
}

这个uploadArchives 其实就是uploadConfigurationName,其中archives就是上文中的artifacts 的configurationName

备注:gradle1.3之后采用新的机制上传组件,这个待下篇分讲。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-15
  • 2022-02-16
  • 2021-10-28
  • 2021-09-04
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-04-15
  • 2021-08-03
  • 2021-10-18
  • 2021-06-07
  • 2021-05-24
  • 2021-11-21
  • 2022-12-23
相关资源
相似解决方案