正在使用的插件是:' com.jfrog.artifactory'和' maven-publish'
root build.gradle:
function call($controller, $id='') {
switch($controller) {
case '':
break;
case 'pages':
$controller = new PagesController();
break;
case 'articles':
require_once('controllers/' . $controller . 'Controller.php');
require_once('models/articles.php');
$controller = new ArticlesController();
if(!$id){
$controller->{ "blog" }();
}else{
$controller->{ "article" }($id);
}
break;
default:
header("HTTP/1.0 404 Not Found");
include('/views/404.php');
exit;
break;
}
app build.gradle
buildscript {
repositories {
maven {
url 'http://localhost:8081/artifactory/globalmaven'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.0.0"
}
}
allprojects {
repositories {
maven {
url 'http://localhost:8081/artifactory/globalmaven'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
group = 'com.my.package'
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish'
artifactoryPublish {
clientConfig.info.setBuildName('My_special_build_name')
clientConfig.info.setBuildNumber('1')
}
artifactory {
contextUrl = 'http://localhost:8081/artifactory'
publish {
repository {
repoKey = 'Libs-snapshot-local'
username = project.getProperties().artifactory_user
password = project.getProperties().artifactory_password
}
defaults {
publishArtifacts = true
publishPom = false
publishIvy = false
}
}
resolve {
repository {
repoKey = 'globalmaven'
}
}
}
问题是apk没有上传到Artifactory,构建描述符正在上传,一切看起来都不错,只是没有apk神器(apk已经构建,我已经验证它存在且命名正确并且是在正确的道路上)。
输出:
apply plugin: 'com.android.application'
version = "1.0"
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.my.package"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName version
}
buildTypes {
debug {
versionNameSuffix "-SNAPSHOT"
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:23.0.1'
}
publishing.publications {
apk(MavenPublication) {
groupId group
artifactId 'MyArtifact'
artifact("$buildDir/outputs/apk/${project.getName()}-debug.apk")
}
}
答案 0 :(得分:2)
你需要告诉神器插件你想要发布什么。检查artifactory plugin上的publications / publishConfigs属性。
答案 1 :(得分:1)
首先,我不确定向Artifactory发布apk是你想要的。是您要发布到Artifactory的Android应用程序(apk)还是Android库(aar)?无论哪种方式,Owais Ali都是正确的。您需要在项目的根级build.gradle
中指定要发布的内容,如下所示:
artifactory {
defaults {
publications('apk')
publishArtifacts = true
publishPom = true
}
}
即便如此,我认为你可能还会遇到一些问题。请参阅此Stack Overflow线程,了解我遇到的类似问题以及我遇到的解决方案:
Gradle Artifactory Plugin - How to publish artifacts from multiple modules in a project?