pax_global_header 0000666 0000000 0000000 00000000064 12057112634 0014513 g ustar 00root root 0000000 0000000 52 comment=e1ae3c8c691e8dfddf4458fd5d5dbd8f352420be
maven-enforcer-1.0.1/ 0000775 0000000 0000000 00000000000 12057112634 0014421 5 ustar 00root root 0000000 0000000 maven-enforcer-1.0.1/enforcer-api/ 0000775 0000000 0000000 00000000000 12057112634 0016773 5 ustar 00root root 0000000 0000000 maven-enforcer-1.0.1/enforcer-api/pom.xml 0000664 0000000 0000000 00000006162 12057112634 0020315 0 ustar 00root root 0000000 0000000
4.0.0org.apache.maven.enforcerenforcer1.0.1enforcer-api1.0.1jarEnforcer API
This component provides the generic interfaces needed to implement custom rules for the maven-enforcer-plugin.
org.apache.mavenmaven-plugin-apiorg.codehaus.plexusplexus-container-default1.0-alpha-9maven-compiler-plugin1.41.4org.codehaus.plexusplexus-maven-plugindescriptororg.apache.maven.pluginsmaven-assembly-plugin2.2-beta-2custom-rulepre-sitesinglecustom-ruletarget/sitesrc/main/assembly/custom-rule-sample.xmlfalse
maven-enforcer-1.0.1/enforcer-api/src/ 0000775 0000000 0000000 00000000000 12057112634 0017562 5 ustar 00root root 0000000 0000000 maven-enforcer-1.0.1/enforcer-api/src/custom-rule-sample/ 0000775 0000000 0000000 00000000000 12057112634 0023320 5 ustar 00root root 0000000 0000000 maven-enforcer-1.0.1/enforcer-api/src/custom-rule-sample/pom.xml 0000664 0000000 0000000 00000003303 12057112634 0024634 0 ustar 00root root 0000000 0000000
4.0.0custom-rulecustom-rule-samplejar1.0My Custom RuleThis is my custom rule.1.0-beta-12.0.9org.apache.maven.enforcerenforcer-api${api.version}org.apache.mavenmaven-project${maven.version}org.apache.mavenmaven-core${maven.version}org.apache.mavenmaven-artifact${maven.version}org.apache.mavenmaven-plugin-api${maven.version}org.codehaus.plexusplexus-container-default1.0-alpha-9junitjunit3.8.1test
maven-enforcer-1.0.1/enforcer-api/src/custom-rule-sample/src/ 0000775 0000000 0000000 00000000000 12057112634 0024107 5 ustar 00root root 0000000 0000000 maven-enforcer-1.0.1/enforcer-api/src/custom-rule-sample/src/main/ 0000775 0000000 0000000 00000000000 12057112634 0025033 5 ustar 00root root 0000000 0000000 maven-enforcer-1.0.1/enforcer-api/src/custom-rule-sample/src/main/java/ 0000775 0000000 0000000 00000000000 12057112634 0025754 5 ustar 00root root 0000000 0000000 maven-enforcer-1.0.1/enforcer-api/src/custom-rule-sample/src/main/java/org/ 0000775 0000000 0000000 00000000000 12057112634 0026543 5 ustar 00root root 0000000 0000000 maven-enforcer-1.0.1/enforcer-api/src/custom-rule-sample/src/main/java/org/apache/ 0000775 0000000 0000000 00000000000 12057112634 0027764 5 ustar 00root root 0000000 0000000 maven-enforcer-1.0.1/enforcer-api/src/custom-rule-sample/src/main/java/org/apache/maven/ 0000775 0000000 0000000 00000000000 12057112634 0031072 5 ustar 00root root 0000000 0000000 maven-enforcer-1.0.1/enforcer-api/src/custom-rule-sample/src/main/java/org/apache/maven/enforcer/ 0000775 0000000 0000000 00000000000 12057112634 0032675 5 ustar 00root root 0000000 0000000 rule/ 0000775 0000000 0000000 00000000000 12057112634 0033565 5 ustar 00root root 0000000 0000000 maven-enforcer-1.0.1/enforcer-api/src/custom-rule-sample/src/main/java/org/apache/maven/enforcer MyCustomRule.java 0000664 0000000 0000000 00000010033 12057112634 0037035 0 ustar 00root root 0000000 0000000 maven-enforcer-1.0.1/enforcer-api/src/custom-rule-sample/src/main/java/org/apache/maven/enforcer/rule package org.apache.maven.enforcer.rule;
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.enforcer.rule.api.EnforcerRule;
import org.apache.maven.enforcer.rule.api.EnforcerRuleException;
import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.execution.RuntimeInformation;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
/**
* @author Brian Fox
*/
public class MyCustomRule
implements EnforcerRule
{
/**
* Simple param. This rule will fail if the value is true.
*/
private boolean shouldIfail = false;
public void execute( EnforcerRuleHelper helper )
throws EnforcerRuleException
{
Log log = helper.getLog();
try
{
// get the various expressions out of the helper.
MavenProject project = (MavenProject) helper.evaluate( "${project}" );
MavenSession session = (MavenSession) helper.evaluate( "${session}" );
String target = (String) helper.evaluate( "${project.build.directory}" );
String artifactId = (String) helper.evaluate( "${project.artifactId}" );
// retreive any component out of the session directly
ArtifactResolver resolver = (ArtifactResolver) helper.getComponent( ArtifactResolver.class );
RuntimeInformation rti = (RuntimeInformation) helper.getComponent( RuntimeInformation.class );
log.info( "Retrieved Target Folder: " + target );
log.info( "Retrieved ArtifactId: " +artifactId );
log.info( "Retrieved Project: " + project );
log.info( "Retrieved RuntimeInfo: " + rti );
log.info( "Retrieved Session: " + session );
log.info( "Retrieved Resolver: " + resolver );
if ( this.shouldIfail )
{
throw new EnforcerRuleException( "Failing because my param said so." );
}
}
catch ( ComponentLookupException e )
{
throw new EnforcerRuleException( "Unable to lookup a component " + e.getLocalizedMessage(), e );
}
catch ( ExpressionEvaluationException e )
{
throw new EnforcerRuleException( "Unable to lookup an expression " + e.getLocalizedMessage(), e );
}
}
/**
* If your rule is cacheable, you must return a unique id when parameters or conditions
* change that would cause the result to be different. Multiple cached results are stored
* based on their id.
*
* The easiest way to do this is to return a hash computed from the values of your parameters.
*
* If your rule is not cacheable, then the result here is not important, you may return anything.
*/
public String getCacheId()
{
//no hash on boolean...only parameter so no hash is needed.
return ""+this.shouldIfail;
}
/**
* This tells the system if the results are cacheable at all. Keep in mind that during
* forked builds and other things, a given rule may be executed more than once for the same
* project. This means that even things that change from project to project may still
* be cacheable in certain instances.
*/
public boolean isCacheable()
{
return false;
}
/**
* If the rule is cacheable and the same id is found in the cache, the stored results
* are passed to this method to allow double checking of the results. Most of the time
* this can be done by generating unique ids, but sometimes the results of objects returned
* by the helper need to be queried. You may for example, store certain objects in your rule
* and then query them later.
*/
public boolean isResultValid( EnforcerRule arg0 )
{
return false;
}
}
maven-enforcer-1.0.1/enforcer-api/src/custom-rule-sample/src/usage-pom.xml 0000664 0000000 0000000 00000002536 12057112634 0026534 0 ustar 00root root 0000000 0000000 4.0.0org.apache.maven.pluginsmaven-enforcer-plugin-it11pomorg.apache.maven.pluginsmaven-enforcer-plugin1.0-SNAPSHOTcustom-rulecustom-rule-sample1.0enforce[1.3,1.6]2.0.6trueenforce
maven-enforcer-1.0.1/enforcer-api/src/custom-rule-sample/usage-pom.xml 0000664 0000000 0000000 00000003170 12057112634 0025740 0 ustar 00root root 0000000 0000000 4.0.0org.apache.maven.pluginsmaven-enforcer-plugin-sample-usage1jarorg.apache.maven.pluginsmaven-enforcer-plugin1.0-beta-1custom-rulecustom-rule-sample1.0enforcefalseenforce
maven-enforcer-1.0.1/enforcer-api/src/main/ 0000775 0000000 0000000 00000000000 12057112634 0020506 5 ustar 00root root 0000000 0000000 maven-enforcer-1.0.1/enforcer-api/src/main/assembly/ 0000775 0000000 0000000 00000000000 12057112634 0022325 5 ustar 00root root 0000000 0000000 maven-enforcer-1.0.1/enforcer-api/src/main/assembly/custom-rule-sample.xml 0000664 0000000 0000000 00000000470 12057112634 0026606 0 ustar 00root root 0000000 0000000 samplefalsezipsrc/custom-rule-sample/custom-rule-sample