Closed sebthom closed 5 years ago
Maybe I misunderstand your issue? You can already define <ignoredScopes>..</ignoredScopes>
...see the docs https://www.mojohaus.org/extra-enforcer-rules/enforceBytecodeVersion.html
<rules>
<enforceBytecodeVersion>
<maxJdkVersion>1.7</maxJdkVersion>
<ignoredScopes>optional</ignoredScopes>
</enforceBytecodeVersion>
</rules>
Thanks for your quick answer! Unfortunately this doesn't seem to work. Probably because "optional" isn't a real dependency scope but a scope modifier as in:
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.8.11</version>
<scope>compile</scope>
<optional>true</optional>
</dependency>
Ah sorry..misunderstanding on my side...
Maybe an attribute for the ignoredScope tag can introduced. Something like <ignoredScope with-optional="true">compile</ignoredScope>
attributes do not work in maven pom files...
But this looks like a logical &&
between ignoredScopes
and optional
...so you have the use case say a dependency in scope compile which has optional:true and other dependencies in scope: test which have also optional:true ?
I think a simple solution in the first step would be having a boolean saying ignoreOptional=true
to ignore all dependencies which have optional:true
? WDYT ?
I basically only want to check the bytecode version of non-optional compile dependencies. I don't care about other scopes. So for my use case I don't require a flag to control that per scope. Something like <ignoreOptionalDependencies/>
would be sufficient.
So it could look like this:
<rules>
<enforceBytecodeVersion>
<maxJdkVersion>1.7</maxJdkVersion>
<ignoreOptional>true</ignoreOptional>
</enforceBytecodeVersion>
</rules>
I think a more specific name would be useful. In ignoreOptional
it may be unclear to users what the term "optional" refers to. Also think it should be plural.
The meaning of ignoreClasses
in contrast is pretty clear: Ignore one (or more) class files.
Sure good point...so ignoreOptionals
?
Works for me.
@khmarbaise could you merge your changes into master and create a new release by any chance?
@khmarbaise any ETA for merge?
It would be great to have an option to ignore optional dependencies.