You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Matthew Flower <ma...@yahoo.com> on 2007/10/02 22:36:46 UTC

Enforce environment variable without transitive dependencies?

I am trying to ensure that a user always specifies a particular environment of either "dev", "qa", or "prod".  I've been doing so by doing:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-property</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <phase>validate</phase>
                        <inherited>false</inherited>
                        <configuration>
                            <rules>
                                <requireProperty>
                                    <property>env</property>
                                    <message>
                                        Missing environment -- please call maven with an environment such as:
                                        mvn -Denv=dev clean install
                                        mvn -Denv=qa clean install
                                        mvn -Denv=prod clean install
                                    </message>
                                    <regex>dev|qa|prod</regex>
                                    <regexMessage>
                                        Invalid environment, valid values are dev, qa, or prod
                                    </regexMessage>
                                </requireProperty>
                            </rules>
                            <fail>true</fail>
                        </configuration>
                    </execution>
                </executions>
            </plugin>


However, this has created a problem.  When I use the project which contains this pom as a dependency in another project, it will enforce the requirement on this new pom.  Has anyone else found a way around this?

Thanks,
Matt



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Enforce environment variable without transitive dependencies?

Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
Set <inherited>false</inherited> in the execution IIRC (I forget the
exact location, but that should get you started)

-----Original Message-----
From: Matthew Flower [mailto:mattflower@yahoo.com] 
Sent: Tuesday, October 02, 2007 4:37 PM
To: users@maven.apache.org
Subject: Enforce environment variable without transitive dependencies?

I am trying to ensure that a user always specifies a particular
environment of either "dev", "qa", or "prod".  I've been doing so by
doing:

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-property</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <phase>validate</phase>
                        <inherited>false</inherited>
                        <configuration>
                            <rules>
                                <requireProperty>
                                    <property>env</property>
                                    <message>
                                        Missing environment -- please
call maven with an environment such as:
                                        mvn -Denv=dev clean install
                                        mvn -Denv=qa clean install
                                        mvn -Denv=prod clean install
                                    </message>
                                    <regex>dev|qa|prod</regex>
                                    <regexMessage>
                                        Invalid environment, valid
values are dev, qa, or prod
                                    </regexMessage>
                                </requireProperty>
                            </rules>
                            <fail>true</fail>
                        </configuration>
                    </execution>
                </executions>
            </plugin>


However, this has created a problem.  When I use the project which
contains this pom as a dependency in another project, it will enforce
the requirement on this new pom.  Has anyone else found a way around
this?

Thanks,
Matt



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org