Search code examples
gradlebuild.gradlegradle-plugingradlewgradle-kotlin-dsl

Migrate Maven-plugins to Gradle: What happens with plugin configurations?


I want to migrate my build process from Maven to Gradle. I was wondering about what happens to the configuration-tag. For example, i got this code block in the pom.xml

<plugin>
            <!-- https://samaxes.github.io/minify-maven-plugin/index.html -->
            <groupId>com.samaxes.maven</groupId>
            <artifactId>minify-maven-plugin</artifactId>
            <version>1.7.4</version>
            <executions>
                <execution>
                    <id>default-minify</id>
                    <configuration>
                        <jsSourceDir>static/js/app</jsSourceDir>
                        <jsSourceFiles>
                            <jsSourceFile>javascript.js</jsSourceFile>
                            <jsSourceFile>wiki-script.js</jsSourceFile>
                            <jsSourceFile>sidr/sidr.js</jsSourceFile>
                        </jsSourceFiles>
                        <webappTargetDir>${basedir}/src/main/webapp</webappTargetDir>
                        <jsEngine>CLOSURE</jsEngine>
                    </configuration>
                    <goals>
                        <goal>minify</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

I know that Gradle doesn't have this plugin. But if i want Gradle to do something that produces the same result, i don't really know how. Do i need tasks for this?


Solution

  • You will need to either:

    1. Find an equivalent Gradle plugin that offers similar capabilities as minify-maven-plugin
    2. Create your own plugin: Developing Custom Gradle Plugins

    From a quick Google search, it seems the org.padler.gradle.minify plugin offers the same capability the Maven one does.