Re: Why is the functionality of the all attribute of the RequireActiveProfile rule commented out?

2013-02-13 Thread Matthew Adams
Ok, I'll have a look, but I'm not the only one who's noticed:

http://jira.codehaus.org/browse/MENFORCER-143



--
View this message in context: 
http://maven.40175.n5.nabble.com/Why-is-the-functionality-of-the-all-attribute-of-the-RequireActiveProfile-rule-commented-out-tp5746380p5746901.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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



Re: Why is the functionality of the all attribute of the RequireActiveProfile rule commented out?

2013-02-13 Thread Matthew Adams
Ok, I found the change:
http://svn.apache.org/viewvc/maven/enforcer/trunk/enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/RequireActiveProfile.java?r1=594911r2=595611diff_format=h

It was done by Brian Fox, whom I've copied on this post.  Hopefully, he'll
shed some light on the subject.



--
View this message in context: 
http://maven.40175.n5.nabble.com/Why-is-the-functionality-of-the-all-attribute-of-the-RequireActiveProfile-rule-commented-out-tp5746380p5746905.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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



Re: Why is the functionality of the all attribute of the RequireActiveProfile rule commented out?

2013-02-13 Thread Wayne Fay
 Ok, I found the change:
...
 It was done by Brian Fox, whom I've copied on this post.  Hopefully, he'll
 shed some light on the subject.

Yes, I found that and was going to reply back with it but you beat me to it:
http://svn.apache.org/viewvc?view=revisionrevision=595611

Based on the commit comment and the other files in the same commit, it
seems to me that either: a) the removal of all was unintentional and
simply came in with some other changes so it could be fixed easily or
b) all was removed and replaced with another enforcer rule, so you
just need to specify some additional configuration. Did you look at
the rest of the commit changes to see if B is possible?

Wayne

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



Re: Why is the functionality of the all attribute of the RequireActiveProfile rule commented out?

2013-02-12 Thread Wayne Fay
 Found it at https://svn.apache.org/repos/asf/maven/enforcer.

 Still, what gives?  Why is it commented out?

You'd have to check svn logs/history to see who commented it out, and
ask them directly. ;-)

Wayne

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



Why is the functionality of the all attribute of the RequireActiveProfile rule commented out?

2013-02-08 Thread Matthew Adams
I'm trying to use the requireActiveProfile rule via the
maven-enforcer-plugin, version 1.2:
=
plugin
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-enforcer-plugin/artifactId
version${app.maven-enforcer-plugin.version}/version
executions
execution
idrequire-orm-profiles/id
goals
goalenforce/goal
/goals
configuration
rules
requireActiveProfile

profileshibernate,datanucleus/profiles
*/allfalse/all/*
/requireActiveProfile
/rules
/configuration
/execution
/executions
/plugin
=
It doesn't work, and here, apparently is why:  the code that uses the all
attribute on the class RequireActiveProfile is commented out (downloaded
from
http://search.maven.org/remotecontent?filepath=org/apache/maven/enforcer/enforcer-rules/1.2/enforcer-rules-1.2-sources.jar).
=
public class RequireActiveProfile
extends AbstractNonCacheableEnforcerRule
{

/** Comma separated list of profiles to check. */
public String profiles = null;

/** If all profiles must be active. If false, only one must be active */
public boolean all = true;

/*
 * (non-Javadoc)
 *
 * @see
org.apache.maven.enforcer.rule.api.EnforcerRule#execute(org.apache.maven.enforcer.rule.api.EnforcerRuleHelper)
 */
public void execute( EnforcerRuleHelper theHelper )
throws EnforcerRuleException
{
ListString missingProfiles = new ArrayListString();
try
{
MavenProject project = (MavenProject) theHelper.evaluate(
${project} );
if ( StringUtils.isNotEmpty( profiles ) )
{
String[] profs = profiles.split( , );
for ( String profile : profs )
{
if ( !isProfileActive( project, profile ) )
{
missingProfiles.add( profile );
}
}

boolean fail = false;
if ( !missingProfiles.isEmpty() )
{
fail = true;
*
// if (all  missingProfiles.size() != profs.length)
// {
// fail = true;
// }
// else
// {
// if (!all  missingProfiles.size() = (profs.length
-1))
// {
// fail = true;
// }
// }
*
}

if ( fail )
{
StringBuilder buf = new StringBuilder();
if ( message != null )
{
buf.append( message + \n );
}

for ( String profile : missingProfiles )
{
buf.append( Profile \ + profile + \ is not
activated.\n );
}

throw new EnforcerRuleException( buf.toString() );
}

}

}
catch ( ExpressionEvaluationException e )
{
throw new EnforcerRuleException( Unable to retrieve the
project., e );
}

}
// ...
=
I saw https://jira.codehaus.org/browse/MENFORCER-143 and it says this was
fixed in 1.1.1.  What gives?

/NB:  I can't seem to find where the svn repo is that contains
RequireActiveProfile.java, which is why I used the maven repo search link./

Thanks,
Matthew



--
View this message in context: 
http://maven.40175.n5.nabble.com/Why-is-the-functionality-of-the-all-attribute-of-the-RequireActiveProfile-rule-commented-out-tp5746380.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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



Re: Why is the functionality of the all attribute of the RequireActiveProfile rule commented out?

2013-02-08 Thread Matthew Adams
Matthew Adams wrote/
 NB:  I can't seem to find where the svn repo is that contains
 RequireActiveProfile.java, which is why I used the maven repo search link.
/
Found it at https://svn.apache.org/repos/asf/maven/enforcer.

Still, what gives?  Why is it commented out?



--
View this message in context: 
http://maven.40175.n5.nabble.com/Why-is-the-functionality-of-the-all-attribute-of-the-RequireActiveProfile-rule-commented-out-tp5746380p5746386.html
Sent from the Maven - Users mailing list archive at Nabble.com.

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