android - Android Studio 中未生成项目的 POM 文件
问题描述
如何在 android studio 中为 artifactory 创建 pom 文件?
我按照上面的线程。仍然没有在 android studio 库项目的根目录中生成我的 android 库的 .POM 文件。这里附加了两个 build.gradle 文件。请帮忙。
buildscript {
ext.kotlin_version = "1.5.0"
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
maven{ url 'https://jitpack.io'
jcenter()}
// Warning: this repository is going to shut down soon
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
同样,app 级别的 build.gradle 也附上。
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'maven-publish'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
apply plugin: 'maven-publish'
defaultConfig {
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'com.google.mlkit:face-detection:16.1.2'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
testImplementation 'junit:junit:4.+'
implementation "androidx.lifecycle:lifecycle-livedata:2.3.1"
implementation "androidx.lifecycle:lifecycle-viewmodel:2.3.1"
implementation 'com.google.mlkit:camera:16.0.0-beta1'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation "androidx.camera:camera-camera2:1.0.0-SNAPSHOT"
implementation "androidx.camera:camera-lifecycle:1.0.0-SNAPSHOT"
implementation "androidx.camera:camera-view:1.0.0-SNAPSHOT"
}
afterEvaluate {
publishing {
publications {
// Creates a Maven publication called "release".
release(MavenPublication) {
// Applies the component for the release build variant.
from components.release
// You can then customize attributes of the publication as shown below.
groupId = 'com.example.librarymoduletesting'
artifactId = 'final'
version = '1.0'
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
//Iterate over the compile dependencies (we don't want the test ones), adding a <dependency>
node for each
configurations.api.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
// Creates a Maven publication called “debug”.
debug(MavenPublication) {
// Applies the component for the debug build variant.
from components.debug
groupId = 'com.example.librarymoduletesting'
artifactId = 'final-debug'
version = '1.0'
}
}
}
}
解决方案
推荐阅读
- python - 在大型数据集中加速 groupby 和聚合
- python - 以 1 Min 频率 Python 在时间序列中删除具有 Nan 值的任何一天
- jenkins - 管理两个不同但相关的詹金斯作业的构建
- angular - 发生未处理的异常:开发服务器仅支持每次构建本地化单个语言环境
- android - 安卓模拟器图标不见了
- c++ - LeetCode 问题:在没有哈希的情况下提高执行时间?
- javascript - Discord.js 角色反应
- aws-appsync - AppSync 解析器:不允许在 JSON 字符串末尾使用尾随字符
- c# - 如何以编程方式两次运行相同的 Nunit 测试?
- python - 每次变量增加时如何调用方法?