Well if I had to do it I would actually have a look in the code of the
maven-help-plugin. Seems like it wouldn't be difficult from there to
implement the plugin you want…

SaM

On Fri, Mar 14, 2008 at 6:40 AM, Chris Patti <[EMAIL PROTECTED]> wrote:

> Folks;
>
> What I want to do is fairly simple.  We have a number of destructive unit
> tests in our environment that should NEVER be run against production, and
> I
> want to enforce that by attaching a plugin to the validate or initialize
> phase that will fail the build if "PROD" is in the current list of active
> profiles AND if maven.test.skip is either false or undefined.
>
>            <plugin>
>                <groupId>org.codehaus.mojo.groovy</groupId>
>                <artifactId>groovy-maven-plugin</artifactId>
>                <executions>
>                    <execution>
>                        <id>prevent-tests-against-prod</id>
>                        <phase>initialize</phase>
>                        <goals>
>                            <goal>execute</goal>
>                        </goals>
>                        <configuration>
>                            <source>
>                                if ((${project.activeprofile} == "PROD")
>                                && (${maven.test.skip} != "true"))
>                                {
>                                   fail("Running unit tests against
> production is NEVER OK!");
>                                }
>                            </source>
>                        </configuration>
>                    </execution>
> ... (additional executions follow>
>
> So, is there a way to make this happen? I realize I can use mvn
> help:active-profiles but having to parse the output of that command is
> messy
> and I'm guessing there's a better way.
>
> Thanks,
> -Chris
>
> --
> Chris Patti --- Y!: feoh -- AIM: chrisfeohpatti --- E-Mail:
> [EMAIL PROTECTED]
> "Technological progress is like an ax in the hands of a pathological
> criminal." -Albert Einstein
>



-- 
Samuel Le Berrigaud

Reply via email to