четверг, 22 декабря 2016 г.

Maven Enforcer Plugin

Due to continuous integration sometimes it is difficult to control build environment. Someone can wrongly setup Jenkins job and your project won't build. In order to identify such errors much more faster one can use maven-enforcer-plugin. Just add the following xml to the pom and that's it:

                <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>${maven.enforcer.plugin.version}</version>
                <executions>
                    <execution>
                        <id>enforce-versions</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireMavenVersion>
                                    <!--
                                      Maven 3.0.3 or later. That's the earliest version to enforce
                                      declaration ordering for plugins in the same phase.
                                     -->
                                    <version>[3.0.3,)</version>
                                </requireMavenVersion>
                                <requireJavaVersion>
                                    <!-- Java 1.8 or later. -->
                                    <version>[${java.version},)</version>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Комментариев нет:

Отправить комментарий