Skip to content

Classes under excluded paths are checked by configurableRules.  #36

@KayWeinert

Description

@KayWeinert

Summary

Classes under excluded paths are checked by configurableRules.

Type of Issue

It is a :

  • bug
  • request
  • question regarding the documentation

Motivation

It's the first time that i'm using arch-unit-maven-plugin so maybe it's not a bug but a misconfiguration.

Current Behavior

Classes under excluded paths are checked by configurableRules. I have a multi module maven projekt and one of the sub modules generates classes in the folder generated-sources\annotations\my.packages which are checked by a configurable rules.

Expected Behavior

Classes under excluded path are ignored by configurableRules.

Steps to Reproduce (for bugs)

this is the plugin configuration in my main pom:


<plugins>
	<plugin>
		<groupId>com.societegenerale.commons</groupId>
		<artifactId>arch-unit-maven-plugin</artifactId>
		<version>2.4.0</version>
		<configuration>
			<projectPath>${project.basedir}/target</projectPath>

			<!-- optional - you can exclude classes that have a path containing any of the mentioned paths -->
			<excludedPaths>
				<excludedPath>generated-sources</excludedPath>                    
			</excludedPaths>

			<rules>
				<!-- using a rule available out of the box... -->
				<preConfiguredRules>
					<rule>com.societegenerale.commons.plugin.rules.NoPublicFieldRuleTest</rule>
					<rule>com.societegenerale.commons.plugin.rules.NoStandardStreamRuleTest</rule>
					<rule>com.societegenerale.commons.plugin.rules.NoJodaTimeRuleTest</rule>
					<rule>com.societegenerale.commons.plugin.rules.NoPrefixForInterfacesRuleTest</rule>
				</preConfiguredRules>
				<!-- ... and a custom one, coming from a dependency of the plugin -->
				<configurableRules>
					<configurableRule>
						<rule>com.tngtech.archunit.library.GeneralCodingRules</rule>
						<applyOn>
							<packageName>my.packages</packageName>
							<!-- scope can be "main" or "test" -->
							<scope>main</scope>

						</applyOn>

						<checks>
							<!-- otherwise you can specify either field or method names here. If no checks block is defined, all are executed -->
							<!-- <check>NO_CLASSES_SHOULD_ACCESS_STANDARD_STREAMS</check>-->
						</checks>
					</configurableRule>
				</configurableRules>

			</rules>
		</configuration>
		<executions>
			<execution>
				<phase>test</phase>
				<goals>
					<goal>arch-test</goal>
				</goals>
			</execution>
		</executions>               
	</plugin>
</plugins>

Your Environment

  • Version used: 2,4,0
  • OS and version: Window 10
  • Version of libs used: Java 11, Maven 3.6.3, archunit 0.14.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions