跳过上传丢失的aar和pom文件(代码片段)

author author     2023-05-09     496

关键词:

我正在为Android构建一个aar库,我正面临着一个问题。不上传POM和ARR文件。

有一个错误

跳过上传丢失文件'F: Android Personal_Project sampleMavenLib sinalib build outputs aar sinalib-release.aar'。跳过上传丢失文件'F: Android Personal_Project sampleMavenLib sinalib build publications Production pom-default.xml'。

我检查了这两个路径和aar文件在那里,它生成但没有任何路径的pom文件

这是我的傻瓜

apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'

android 
    compileSdkVersion 28

defaultConfig 
    minSdkVersion 17
    targetSdkVersion 28
    versionCode 1
    versionName "1.0.2"

    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"


buildTypes 
    release 
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        
    


buildscript 
    repositories 
        jcenter()
    
    dependencies 
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'
        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
    


ext 
    bintrayRepo = 'maven'
    bintrayName = 'sinalib'

    publishedGroupId = 'come.sinarahimi.sinalib'
    libraryName = 'Sinalib'
    artifact = 'sinalib'

libraryDescription = 'This view is a container that supports diagonal scroll and fling gesture. It is based on AOSP HorizontalScrollView.'

siteUrl = 'https://github.com/Sinarahimi/sampleMavenLib'
gitUrl = 'https://github.com/Sinarahimi/sampleMavenLib.git'

libraryVersion = '1.0.2'

developerId = 'sinarahimi'
developerName = 'Sina RAHIMI'
developerEmail = 'develop.rahimi95@gmail.com'

licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]

publishing 
    publications 
        Production(MavenPublication) 
            artifact("$buildDir/outputs/aar/sinalib-release.aar")
            groupId publishedGroupId
            artifactId artifact
            version libraryVersion

            //The publication doesn't know about our dependencies, so we have to manually add them to the pom
            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.compile.allDependencies.each 
                    def dependencyNode = dependenciesNode.appendNode('dependency')
                    dependencyNode.appendNode('groupId', it.group)
                    dependencyNode.appendNode('artifactId', it.name)
                    dependencyNode.appendNode('version', it.version)
                
            
        
    
    bintray 
        // Get Bintray credential from environment variable

        Properties properties = new Properties()
 properties.load(project.rootProject.file('local.properties').newDataInputStrea( 
        ))
        user = properties.getProperty('user')
        key = properties.getProperty('apikey')
        override = true
        pkg 
            repo = bintrayRepo
            name = project.name
            userOrg = 'sinara'
            licenses = allLicenses
            desc = libraryDescription
            websiteUrl = siteUrl
            vcsUrl = gitUrl
            version 
                name = libraryVersion
            
            publish = true
        
        publications = ['Production']
    

    dependencies 
        implementation fileTree(dir: 'libs', include: ['*.jar'])

        implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.2'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    

答案

在我尝试了很多东西后,我发现了两点:

1 - 我改变了这个

artifact("$buildDir/outputs/aar/sinalib-release.aar")

artifact("build/outputs/aar/sinalib-release.aar")

2 - 您在bintray.com中创建的存储库应与pkg部分中的存储库相同。

这解决了错误Skipping upload for missing file并上传了arr文件。但仍然存在一个错误,即它无法上传并生成pom文件。

所以我找到了这个命令:

clean build generatePomFileForProductionPublication bintrayUpload

这对我有用,但仍然有一个问题,将依赖项添加到pom虽然我有这个代码它不起作用:

//The publication doesn't know about our dependencies, so we have to manually add them to the pom
        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.compile.allDependencies.each 
                def dependencyNode = dependenciesNode.appendNode('dependency')
                dependencyNode.appendNode('groupId', it.group)
                dependencyNode.appendNode('artifactId', it.name)
                dependencyNode.appendNode('version', it.version)
            
另一答案

尝试generatePomFileForReleasePublication或publishReleasePublicationToMavenLocal。

完整的表述是:

./gradlew clean build generatePomFileForReleasePublicationbintrayUpload -PbintrayUser=<BINTRAY_USER> -PbintrayKey=<BINTRAY_KEY> -PdryRun=false

如何手动从 jitpack.io 下载 aar 和 pom 文件?

】如何手动从jitpack.io下载aar和pom文件?【英文标题】:Howtodownloadaarandpomfilefromjitpack.iomanually?【发布时间】:2021-11-0509:51:40【问题描述】:我的一个客户的环境受限,无法在Android工作室中获取少量传递依赖项。由jitpack.io提供服... 查看详情

aar包中的依赖

...implementation或者api,打成aar包之后,当我们通过gradle脚本上传到服务器时,我们可以通过pom.project来将aar源码中的依赖生成pom.xml文件。这些依赖配置项会通过脚本,被转义成maven中的依赖配置项。脚本片段如下:上面是我们工程... 查看详情

安卓上传aar到jitpack仓库使用和示例(代码片段)

安卓上传aar到jitpack仓库使用和示例https://jitpack.io/仓库使用示例https://github.com/chenjim/JitpackDemo本文首发地址https://blog.csdn.net/CSqingchen/article/details/119816973最新更新地址https://gitee.com/chenjim/chenjimblog增加./jitp 查看详情

使用依赖 pom/iml 文件手动添加 aar

】使用依赖pom/iml文件手动添加aar【英文标题】:Manuallyaddingaarwithdependencypom/imlfile【发布时间】:2016-04-2415:59:16【问题描述】:由于我不能使用私有maven来共享我的库,我正在考虑共享aar并导入另一个项目。当aar和jar文件不包含任... 查看详情

Gradle 将sources.jar 和aar 上传到jfrog artifactory。 artifactoryPublish 会生成两个 pom-default.xml,它会随机推送其中一个

】Gradle将sources.jar和aar上传到jfrogartifactory。artifactoryPublish会生成两个pom-default.xml,它会随机推送其中一个【英文标题】:Gradleuploadsources.jarandaartojfrogartifactory.artifactoryPublishwillgeneratetwopom-default.xml,itwillpushlishoneofthemr 查看详情

这恐怕是史上最简单的上传aar教程(代码片段)

...里就是AAR。因为我是个人开发,想到方便的方法就是把AAR上传到本地maven库,用到的项目只需要添加对它的依赖就可以了。上传配置1.首先在要上传的模块的build.gradle里最外层添加如下代码,并做相应的配置applyplugin:‘maven‘ 查看详情

安卓上传aar到jitpack仓库使用和示例(代码片段)

安卓上传aar到jitpack仓库使用和示例https://jitpack.io/仓库使用示例https://github.com/chenjim/JitpackDemo本文首发地址https://blog.csdn.net/CSqingchen/article/details/119816973最新更新地址https://gitee.com/chenjim/chenjimblog增加./jitpack.yml使用jdk11还可以配置编... 查看详情

修改aar和jar中class文件(代码片段)

前言最近帮助同事解决了一个比较棘手的问题,一路采坑的过程比较有意思。在此记录下来。(PS:主要原因是项目比较大,我们只有整个Android项目部分业务侧代码的开发权限。所以解决问题的一些解决问题的常... 查看详情

为什么我所有的文件上传都跳过elseif条件?(代码片段)

...应该抛出"如果"。alert();里面elseif()条件的块。相反,它被跳过了。我正在用37.3MB的.mov文件测试。我做错了什么?functionfileValidationWinnerPhoto()constrealFileBtn=document.getElementById("real-file");letfilePath=realFileBtn.value;letmaxSize=10485760;//Allowingfil... 查看详情

多文件上传commonsmultipartresolver(代码片段)

1、CommonsMultipartResolver是spring里面提供的一个上传方式,效率我不知道,但是加入spring容器管理还是很不错的。2、先看依赖包pom.xml<projectxmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:sche 查看详情

as打包包含so的aar和引入aar(代码片段)

android studio 引用aar 1,建仓库repositoriesflatDirdirs‘libs‘  2,app的build.gradle引入aarimplementation(name:‘aar名称‘,ext:‘aar‘)   android studio打包包含so的aar 1,在module中 查看详情

java:springboot使用easyexcel实现excel文件的导出下载和上传导入功能(代码片段)

SpringBoot使用EasyExcel实现Excel文件的导出下载和上传导入功能文件目录$tree-Itarget.├──README.md├──pom.xml└──src└──main├──java│└──com│└──example│└──demo│├──DemoApplication.java│├──controller││└──EasyE... 查看详情

文件上传:commonsmultipartresolver(代码片段)

...CommonsMultipartResolver是基于Apache的CommonsFileUpload来实现文件上传功能的,主要作用是配置文件上传的一些属性。二.配置    1)依赖Apache的CommonsFileUpload,所以Maven的pom文件添加依赖;<dependency> <groupId>commons-fileupload</gro 查看详情

黏包-黏包的成因解决方式及struct模块初识文件的上传和下载(代码片段)

黏包:同时执行多条命令之后,得到的结果很可能只有一部分,在执行其他命令的时候又接收到之前执行的另外一部分结果,这种显现就是黏包。只有TCP协议中才会产生黏包,UDP协议中不会有黏包(udp协议中数据会直接丢失,俗... 查看详情

上传图片到liunx系统,需要哪些配置?(代码片段)

上传资源到Linux上步骤需要:添加相应的依赖(需要下载并放到maven仓库中,否则pom.xml中下载不了)添加配置文件client.conf和picurl.properties工具类FastDFSClient1、首先先在pom文件添加相应的依赖 <dependency><groupId&g... 查看详情

上传图片到liunx系统,需要哪些配置?(代码片段)

上传资源到Linux上步骤需要:添加相应的依赖(需要下载并放到maven仓库中,否则pom.xml中下载不了)添加配置文件client.conf和picurl.properties工具类FastDFSClient1、首先先在pom文件添加相应的依赖<dependency><groupId>... 查看详情

上传图片到liunx系统,需要哪些配置?(代码片段)

上传资源到Linux上步骤需要:添加相应的依赖(需要下载并放到maven仓库中,否则pom.xml中下载不了)添加配置文件client.conf和picurl.properties工具类FastDFSClient1、首先先在pom文件添加相应的依赖 <dependency><groupId&g... 查看详情

上传图片到liunx系统,需要哪些配置?(代码片段)

上传资源到Linux上步骤需要:添加相应的依赖(需要下载并放到maven仓库中,否则pom.xml中下载不了)添加配置文件client.conf和picurl.properties工具类FastDFSClient1、首先先在pom文件添加相应的依赖<dependency><groupId>... 查看详情