I want to support both gradle wrapper and maven wrapper in a single project for my users’ benefit. I want to work only in gradle, but produce a pom.xml and mvnw script.
I’m trying to use the maven-plugin’s pom method to create a element like this:
task mavenWrapper {
doLast {
delete 'pom.xml', 'mvnw', 'mvnw.cmd'
pom {
project {
// .. other stuff..
build {
// .. this causes error
}
}
}
}
}
But I’m getting this error on the build block:
Execution failed for task ':mavenWrapper'.
> No such property: _SCRIPT_CLASS_NAME_ for class: org.apache.maven.model.Model
Right now I’m building the build block manually in the withXml method, but it’s ugly. The DSL looks like it should support this. I’m guessing that the build work is finding the task before the DSL verb, and that’s not what I want. How do I get build to be recognized as the DSL verb?
I’ve already asked this question on Stack Overflow.
The relevant snippet is just this: