Some differences caused by different versions of Grdle

The gradle version is continuously upgraded iteratively. After the upgrade, it will affect some configurations, such as the kotlin configuration and the way of uploading maven. Hereby record it

Impact on kotlin configuration

The gradle version of our main project is 6.3, and the grammar of koltin configuration is used for the project. The official document tutorial is the same. The
insert image description here
gradle version number of the newly created project is 7.3.3

insert image description here
insert image description here
First of all, the grammatical structure has been adjusted, which has little to do with it. The biggest thing is that the app's build.gradle does not need to rely on
the implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:xxxx'
because it will automatically depend on it.
However, the kotlin plug-in version is required for compatibility with other projects in the aar package Changed to 1.3.72, the result is an error when it is built.
insert image description here
It may be that the lower version of the koltin plugin will not automatically import the kotlin-stdlib package. You need to manually import the
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72 '
It will be normal to build again.

reference

Add Kotlin to an existing application

Impact on the way of uploading maven

The previous way was

apply plugin: 'maven'

boolean isRelease = false

uploadArchives {
    
    
    repositories {
    
    
        mavenDeployer {
    
    
            if (isRelease) {
    
    
                repository(url: 'http://10.xx.xx.60:8081/repository/maven-releases/') {
    
    
                    authentication(userName: 'admin', password: 'xxxx')
                }

                pom.project {
    
    
                    version gradle.ext.versionName
                    artifactId 'sohuPush'
                    groupId 'com.sohu.sohuPush'
                    packaging 'aar'
                    description 'SohuVideo com.sohu.sohuPush'
                }
            } else {
    
    
                snapshotRepository(url: 'http://10.xx.xxx.60:8081/repository/maven-snapshots/') {
    
    
                    authentication(userName: 'deployment', password: 'xxxx')
                }

                pom.project {
    
    
                    version gradle.ext.versionName + "-SNAPSHOT"
                    artifactId 'sohuPush'
                    groupId 'com.sohu.sohuPush'
                    packaging 'aar'
                    description 'SohuVideo com.sohu.sohuPush'
                }
            }

        }
    }
}

Now the syntax has changed

apply plugin: 'maven-publish'

boolean isRelease = false

afterEvaluate {
    
    
    publishing {
    
    
        publications {
    
    
            maven(MavenPublication) {
    
    
                groupId = 'com.sohu.clipImage'
                artifactId = 'clipImage'
                if (isRelease) {
    
    
                    version = gradle.ext.versionName
                    from components.release
                } else {
    
    
                    version = gradle.ext.versionName + "-SNAPSHOT"
                    from components.debug
                }
                description 'SohuVideo com.sohu.clipImage'
            }
        }
        repositories {
    
    
            maven {
    
    
                if (isRelease) {
    
    
                    allowInsecureProtocol = true
                    url = 'http://10.xx.xxx.60:8081/repository/maven-releases/'
                    credentials {
    
    
                        it.username = 'admin'
                        it.password = 'xxxxx'
                    }
                } else {
    
    
                    allowInsecureProtocol = true
                    url = 'http://10.xx.xxx.60:8081/repository/maven-snapshots/'
                    credentials {
    
    
                        it.username = 'deployment'
                        it.password = 'xxxxxx'
                    }
                }

            }
        }
    }
}

reference

Plugin with id ‘maven’ not found.
maven-publish插件的使用
Plugin with id ‘maven’ not found
Plugin with id ‘maven‘ not found或者Plugin [id: ‘maven‘] was not found in any of the following sources
Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven…

Guess you like

Origin blog.csdn.net/lizhongyisailang/article/details/131302568