Codarama / diet-maven-mojo

A maven mojo that utilizes the diet-core to slimify the project and its dependencies
diet.codarama.org
MIT License
2 stars 0 forks source link

Diet Maven Mojo

The Diet Maven Mojo is a Maven Mojo that provides an easy to use interface to the Diet Engine for projects that are built by Maven.

Usage

As a separate build goal

To include the plugin as a part of your build you would need to only add this to your pom.xml file :

<build>
    <plugins>
        <plugin>
            <groupId>org.codarama.diet</groupId>
            <artifactId>diet-maven-mojo</artifactId>
            <version>0.0.1</version>
        </plugin>
    </plugins>
</build>

, and then execute the goal as follows :

mvn clean diet:putondiet install

As part of some of the existing phases

If you are bold enough you could simply put the plugin as part of one of the existing phases :

<build>
    <plugins>
        <plugin>
            <groupId>org.codarama.diet</groupId>
            <artifactId>diet-maven-mojo</artifactId>
            <version>1.0.0</version>
            <inherited>true</inherited>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>putondiet</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

, and then executing any goal that includes the package phase would also execute the mojo :

mvn clean install

Configuration

<build>
    <plugins>
        <plugin>
            <groupId>org.codarama.diet</groupId>
            <artifactId>diet-maven-mojo</artifactId>
            <version>1.0.0</version>
            <inherited>true</inherited>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>putondiet</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <sources>/home/root/project/sources</sources>
                <libs>/usr/local/jdk/libs</libs>
                <target>/home/root/project/target</target>
                <forceInclude>
                    <lib>/usr/local/jdk/libs/myRuntimeLibrary1.jar</lib>
                    <lib>/usr/local/jdk/libs/myRuntimeLibrary2.jar</lib>
                    <lib>/usr/local/jdk/libs/myRuntimeLibrary3.jar</lib>
                </forceInclude>
            </configuration>
        </plugin>
    </plugins>
</build>

Where:

Notes