codestyle/src/main/java/se/jguru/nazgul/tools/codestyle/enforcer/rules/RestrictImplDependencies.java
@SuppressWarnings({"unchecked"})
    @Override
    protected void performValidation(final MavenProject project, final EnforcerRuleHelper helper)
            throws RuleFailureException {

        // Acquire the ProjectType
        final ProjectType projectType;
        try {
            projectType = ProjectType.getProjectType(project);
        } catch (IllegalArgumentException e) {
            throw new RuleFailureException("Incorrect project definition for " + project, e);
        }

        // Don't evaluate for ignored project types.
        if (IGNORED_PROJECT_TYPES.contains(projectType)) {
            return;
        }

        // Don't evaluate if told not to.
        if (matches(project.getGroupId(), dontEvaluateGroupIds)) {

            // Log somewhat
            helper.getLog().debug("Ignored [" + project.getGroupId() + ":" + project.getArtifactId()
                    + "] since its groupId was excluded from enforcement.");
            return;

        }

        // Don't evaluate if not told to.
        if (!matches(project.getGroupId(), evaluateGroupIds)) {

            // Log somewhat
            helper.getLog().debug("Ignored [" + project.getGroupId() + ":" + project.getArtifactId()
                    + "] since its groupId was not included in enforcement.");
            return;
        }

        // Acquire all project dependencies.
        for (final Artifact current : project.getDependencyArtifacts()) {

            // Don't evaluate for test-scope dependencies.
            if (Artifact.SCOPE_TEST.equalsIgnoreCase(current.getScope())) {
                continue;
            }

            // Should this Artifact be evaluated?
            final boolean isIncludedInEvaluation = matches(current.getGroupId(), evaluateGroupIds);
            final boolean isNotExplicitlyExcludedFromEvaluation = !matches(current.getGroupId(), dontEvaluateGroupIds);
            if (isIncludedInEvaluation && isNotExplicitlyExcludedFromEvaluation) {

                final ProjectType artifactProjectType = ProjectType.getProjectType(current);
                final String prefix = "Don't use " + artifactProjectType + " dependencies ";

                if (artifactProjectType == ProjectType.IMPLEMENTATION) {
                    throw new RuleFailureException(prefix + "outside of application projects.", current);
                }

                if (artifactProjectType == ProjectType.TEST) {
                    throw new RuleFailureException(prefix + "in compile scope for non-test artifacts.", current);
                }

                if (artifactProjectType == ProjectType.JEE_APPLICATION
                        || artifactProjectType == ProjectType.PROOF_OF_CONCEPT) {
                    throw new RuleFailureException(prefix + "in bundles.", current);
                }
            }
        }
    }
@SuppressWarnings({"unchecked"})
    @Override
    protected void performValidation(final MavenProject project, final EnforcerRuleHelper helper)
            throws RuleFailureException {

        // Acquire the ProjectType
        final ProjectType projectType;
        try {
            projectType = ProjectType.getProjectType(project);
        } catch (IllegalArgumentException e) {
            throw new RuleFailureException("Incorrect project definition for " + project, e);
        }

        // Don't evaluate for ignored project types.
        if (IGNORED_PROJECT_TYPES.contains(projectType)) {
            return;
        }

        // Don't evaluate if told not to.
        if (matches(project.getGroupId(), dontEvaluateGroupIds)) {

            // Log somewhat
            helper.getLog().debug("Ignored [" + project.getGroupId() + ":" + project.getArtifactId()
                    + "] since its groupId was excluded from enforcement.");
            return;

        }

        // Don't evaluate if not told to.
        if (!matches(project.getGroupId(), evaluateGroupIds)) {

            // Log somewhat
            helper.getLog().debug("Ignored [" + project.getGroupId() + ":" + project.getArtifactId()
                    + "] since its groupId was not included in enforcement.");
            return;
        }

        // Acquire all project dependencies.
        for (final Artifact current : project.getDependencyArtifacts()) {

            // Don't evaluate for test-scope dependencies.
            if (Artifact.SCOPE_TEST.equalsIgnoreCase(current.getScope())) {
                continue;
            }

            // Should this Artifact be evaluated?
            final boolean isIncludedInEvaluation = matches(current.getGroupId(), evaluateGroupIds);
            final boolean isNotExplicitlyExcludedFromEvaluation = !matches(current.getGroupId(), dontEvaluateGroupIds);
            if (isIncludedInEvaluation && isNotExplicitlyExcludedFromEvaluation) {

                final ProjectType artifactProjectType = ProjectType.getProjectType(current);
                final String prefix = "Don't use " + artifactProjectType + " dependencies ";

                if (artifactProjectType == ProjectType.IMPLEMENTATION) {
                    throw new RuleFailureException(prefix + "outside of application projects.", current);
                }

                if (artifactProjectType == ProjectType.TEST) {
                    throw new RuleFailureException(prefix + "in compile scope for non-test artifacts.", current);
                }

                if (artifactProjectType == ProjectType.JEE_APPLICATION
                        || artifactProjectType == ProjectType.PROOF_OF_CONCEPT) {
                    throw new RuleFailureException(prefix + "in bundles.", current);
                }
            }
        }
    }
Delegate method, implemented by concrete subclasses.

@param project The active MavenProject.
@param helper  The EnforcerRuleHelper instance, from which the MavenProject has been retrieved.
@throws RuleFailureException If the enforcer rule was not satisfied.