参考资料 https://www.baeldung.com/gradle-build-to-maven-pom https://www.cnblogs.com/clipboard/p/13762512.html
https://www.programminghunter.com/article/475187316/
一开始是新版本2021 Idea运行一些低版本的gradle工程报错,下载老版本2020 idea runtime也进行的替换成jdk1.8最终还是不行。
改造Gradle
plugins {id 'nebula.netflixoss' version '2.2.10'}// https://www.baeldung.com/gradle-build-to-maven-pom// Establish version and statusext.githubProjectName = rootProject.name // Change if github project name is not the same as the root project's nameapply plugin: 'maven'subprojects {apply plugin: 'nebula.netflixoss'apply plugin: 'java'version = '1.0'sourceCompatibility = 1.8targetCompatibility = 1.8group = "com.netflix.ribbon" // TEMPLATE: Set to organization of projectrepositories {jcenter()}if (project.hasProperty('useMavenLocal')) {repositories {mavenLocal()}}if (project.getProperty('status').equals("snapshot")) {repositories {maven { url 'http://oss.jfrog.org/oss-snapshot-local' }}}}task writeNewPom << {pom {project {inceptionYear '2008'licenses {license {name 'The Apache Software License, Version 2.0'url 'http://www.apache.org/licenses/LICENSE-2.0.txt'distribution 'repo'}}}}.writeTo("$buildDir/pom.xml")}
执行命令
./gradlew clean install./gradlew writeNewPom
脚本
把生成的pom.xml全部移出来
#!/bin/shclearfunction showMsg(){echo -e "\033[32m$1\033[0m"}pomDefaultFile="build/publications/mavenNebula/pom-default.xml"DIR="$( cd "$( dirname "$0" )" && pwd )"dir=$(ls)for item in $dirdomv $DIR/$item/$pomDefaultFile $DIR/$item/pom.xml# showMsg "$DIR/$item"showMsg "$item"done
