Brian,
Below is my working configuration

     <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>1.0-alpha-3-SNAPSHOT</version>
        <executions>
          <execution>
            <id>enforce-java</id>
            <goals>
              <goal>enforce-once</goal>
            </goals>
            <configuration>
              <rules>
                <requireProperty>
                   <property>datasource.driver</property>
                </requireProperty>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

FYI: <requireProperty> is not listed in the "Standard Rules" navigation bar[1].

Thank you,

Paul Spencer

[1]http://maven.apache.org/plugins/maven-enforcer-plugin/

Brian E. Fox wrote:
If you are just interesting in checking properties, take a look at the
new requireProperty rule, it has the ability to check the property and
run regEx on the value.

Regarding the specific error you pasted below using the beanShell rule,
can you run with mvn -X and open a jira with the output?

Thanks.

-----Original Message-----
From: Paul Spencer [mailto:[EMAIL PROTECTED] Sent: Monday, June 25, 2007 8:55 AM
To: Maven Users List
Subject: What is syntax for beanshell condition in the enforcer plugin?

I would like to use the enforcer plugin to verify that a required properties is set, specifically it is exists and is not null or a zero length string. I suspect my syntax is incorrect.

What should is the correct syntax?

The following is the error message from the plugin and the
configuration.

***
* Message from plugin
***
[WARNING] Rule 0: org.apache.maven.plugin.enforcer.EvaluateBeanshell failed with message: Unable to lookup a component

***
* Plugin configuration from pom.xml
***
   <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-enforcer-plugin</artifactId>
     <version>1.0-alpha-3-SNAPSHOT</version>
     <executions>
       <execution>
         <id>enforce-beanshell</id>
         <goals>
           <goal>enforce-once</goal>
         </goals>
         <configuration>
           <rules>
             <evaluateBeanshell>
               <condition>${not empty datasource.url}</condition>
               <message>
                 The property datasource.url not defined. This is set in
                 profile.
               </message>
             </evaluateBeanshell>
           </rules>
           <fail>true</fail>
         </configuration>
       </execution>
     </executions>
   </plugin>


Paul Spencer

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to