[
http://jira.codehaus.org/browse/MENFORCER-67?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Brian Fox closed MENFORCER-67.
------------------------------
Resolution: Fixed
This appears to have been fixed in:
Revision: 729228
Author: brianf
Date: 11:51:14 PM, Tuesday, December 23, 2008
Message:
MENFORCER-56 - enhanced to cover the RequireFilesDontExist and RequireFilesSize
rules. Also MENFORCER-46: added ITs for the RequireFilesSize rule (it was
completely broken before)
> RequiresFileSize rule does not use the confiugred file list
> -----------------------------------------------------------
>
> Key: MENFORCER-67
> URL: http://jira.codehaus.org/browse/MENFORCER-67
> Project: Maven 2.x Enforcer Plugin
> Issue Type: Bug
> Components: Standard Rules
> Affects Versions: 1.0-alpha-4
> Environment: Windows XP, Maven 2.0.9
> Reporter: Balazs Tothfalussy
>
> I tried to use the requireFilesSize standard rule to validate the filesize of
> the build output file, my configuration:
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-enforcer-plugin</artifactId>
> <version>1.0-alpha-4</version>
> <executions>
> <execution>
> <id>enforce-ear-filesize</id>
> <!-- Default phase is validate, but we need a verify after the
> build is done -->
> <phase>verify</phase>
> <goals>
> <goal>enforce</goal>
> </goals>
> <configuration>
> <rules>
> <requireFilesExist>
> <files>
>
> <file>${project.build.directory}/${project.build.finalName}.ear</file>
> </files>
> </requireFilesExist>
> <requireFilesSize>
> <!-- Size in bytes -->
> <maxsize>5000000</maxsize>
> <files>
>
> <file>${project.build.directory}/${project.build.finalName}.ear</file>
> </files>
> </requireFilesSize>
> </rules>
> </configuration>
> </execution>
> </executions>
> </plugin>
> I experienced, that whatever I configure in the pom of my project, nothing
> happens, although Maven writes out in debug mode, that the rule has been run
> I checked the code in enforcer-rules project, and in the execute method I
> found:
> if ( files.length == 0 )
> {
> try
> {
> MavenProject project = (MavenProject) helper.evaluate(
> "${project}" );
> files[0] = project.getArtifact().getFile();
> this.log = helper.getLog();
> super.execute( helper );
> }
> catch ( ExpressionEvaluationException e )
> {
> throw new EnforcerRuleException( "Unable to retrieve the
> project.", e );
> }
> }
> This code calls super.execute only if the configured file list contains no
> files, in the above configuration requiresFilesExits works, as the execute of
> AbstractRequireFiles runs
> So I propose a fix, which implements the else branch to call
> super.execute(helper) which will call checkFile for every defined file:
> if ( files.length == 0 )
> {
> try
> {
> MavenProject project = (MavenProject) helper.evaluate(
> "${project}" );
> files[0] = project.getArtifact().getFile();
> this.log = helper.getLog();
> super.execute( helper );
> }
> catch ( ExpressionEvaluationException e )
> {
> throw new EnforcerRuleException( "Unable to retrieve the
> project.", e );
> }
> }
> else {
> super.execute(helper);
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira