So I'm trying to convert this maven configuration to gradle
<plugin>
<groupId>io.axoniq</groupId>
<artifactId>axon-dataprotection-maven-plugin</artifactId>
<version>${dataprotection-maven-plugin.version}</version>
<configuration>
<!-- required -->
<packages>
<package>io.axoniq.demo.giftcard.api</package>
</packages>
<!-- optional -->
<outputConfig>axon-data-protection-config.json</outputConfig>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
So I tried with 'gradle init' command but this is what I got
dependencies {
implementation "io.axoniq:axon-dataprotection-maven-plugin:1.0"
}
as you can see I lost the configuration part and also it's the plugin part in maven, isn't it. why does gradle convert it into dependency instead? The configuration part is required anyway so how can I add it into gradle.
CodePudding user response:
Gradle can only migrate simple projects. Projects that are using plugins that require configuration, Gradle can not help here. Especially for plugins that are not common.
There does not exist a community plugin in the Gradle plugin portal for Axon Data Protection, so your only option is to rewrite the plugin for Gradle as documented above:
If a plugin depends on the Maven project, then you will have to rewrite it. Don’t start by considering how the Maven plugin works, but look at what problem it is trying to solve. Then try to work out how to solve that problem in Gradle. You’ll probably find that the two build models are different enough that "transcribing" Maven plugin code into a Gradle plugin just won’t be effective. On the plus side, the plugin is likely to be much easier to write than the original Maven one because Gradle has a much richer build model and API.
See Dealing with uncommon and custom plugins for more details. The source of the plugin is here