从gradle创建maven包装器pom.xml:不能创建<build>元素
我如何设置sourceDirectory
, testSourceDirectory
并在我使用gradle maven-plugin的pom
DSL创建的pom.xml中构建plugins
?
当我添加没有Closure
到我的DSL部分的build
,没关系..但是当我添加build { /* anything else, like actual compile plugins */}
它给了我这个错误:
Execution failed for task ':mavenWrapper'. > No such property: _SCRIPT_CLASS_NAME_ for class: org.apache.maven.model.Model
我猜Gradle将build
视为任务,而不是由org.sonatype.maven.polyglot.groovy.builder.ModelBuilder
生成的DSL谓词。
有没有办法强制build
被视为DSL的一部分? 它可以被施放什么?
现在我正在通过使用.withXml
解决这个问题,但是它非常冗长,而且维护起来也很少。
这里是我工作的缩写版本:
task mavenWrapper { doLast { delete 'pom.xml', 'mvnw', 'mvnw.cmd' pom { project { packaging 'pom' repositories { repository { id 'spring-milestones' name 'Spring Milestones' url 'https://repo.spring.io/libs-milestone' snapshots { enabled 'false' } } } properties { 'kotlin.compiler.incremental' 'true' } /* ******** Problem is here build { plugins { plugin { // ... etc. etc. } } } ******* */ dependencyManagement { dependencies { dependency { groupId 'org.jetbrains.kotlin' artifactId 'kotlin-stdlib-jre8' version "${kotlin_version}" scope 'compile' } } } } }.withXml { // Workaround for the missing build { ... } section above. asNode().appendNode('build').appendNode('plugins') // etc. etc. }.writeTo("${projectDir}/pom.xml") exec { commandLine 'mvn', '-N', 'io.takari:maven:wrapper', '-Dmaven=3.5.0' } } }
- 为什么在OnCreate()中设置ViewTreeObserver> OnScrollChangedListener不会在Android 2.x上调用?
- 在IntelliJ中找到文件,但不是在建立的jar
- Gradle无法解析kotlin gradle插件1.1.1 – InvalidAlgorithmParameterException
- 在模块之间共享编译依赖关系
- Gradle KTS。 如何将依赖关系配置从主构建移动到单独的文件?
- Spring Boot:添加@Transactional会产生java.lang.ClassNotFoundException:org.aspectj.util.PartialOrder $ PartialComparable
- Kapt3:java.io.File不能转换为java.lang.String
- 为什么IntelliJ Idea不能识别我的Spek测试?
- Android,领域,Gradle:错误:注释处理器:找不到RealmProcessor
- 与Android和桌面项目共享一个Kotlin模块
- 在多项目设置中ConfigurationsContainer为空