3 Star 45 Fork 10

Ryan Zhu/OhosExtension

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
upload.gradle 1.67 KB
一键复制 编辑 原始数据 按行查看 历史
apply plugin: 'maven'
apply plugin: 'maven-publish'
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def REMOTE_MAVEN_RELEASE = properties.getProperty('REMOTE_MAVEN_RELEASE')
def REMOTE_MAVEN_SNAPSHOT = properties.getProperty('REMOTE_MAVEN_SNAPSHOT')
def MAVEN_USERNAME = properties.getProperty('MAVEN_USERNAME')
def MAVEN_PASSWORD = properties.getProperty('MAVEN_PASSWORD')
static def which(components, customArtifact) {
if (customArtifact.length() > 0) return null
if (components.findByName('release')) {
return components.release
} else {
return components.java
}
}
//task sourceJar(type: Jar, dependsOn: classes) {
// from sourceSets.main.allSource
// classifier = 'sources'
//}
afterEvaluate { project ->
def customArtifact = rootProject.ext.CUSTOM_ARTIFACT
publishing {
publications {
mavenJava(MavenPublication) {
from which(components, customArtifact)
group = rootProject.ext.DEFAULT_GROUP_ID
artifactId = rootProject.ext.DEFAULT_ARTIFACT_ID
version = rootProject.ext.DEFAULT_VERSION
if (customArtifact.length() > 0) {
artifact customArtifact
}
// artifact(sourceJar)
}
}
repositories {
maven {
url = rootProject.ext.DEFAULT_VERSION.endsWith('SNAPSHOT') ? REMOTE_MAVEN_SNAPSHOT : REMOTE_MAVEN_RELEASE
credentials {
username MAVEN_USERNAME
password MAVEN_PASSWORD
}
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/thoseyears/ohos-extension.git
git@gitee.com:thoseyears/ohos-extension.git
thoseyears
ohos-extension
OhosExtension
master

搜索帮助