extra-enforcer-rules icon indicating copy to clipboard operation
extra-enforcer-rules copied to clipboard

move extra enforcer rules code from org.apache.maven.plugins.enforcer package to a non-Apache package

Open hboutemy opened this issue 9 years ago • 13 comments

having extra-enforcer classes in same package than Enforcer itself is misleading when there is some issue: how can an end-user determine where to report?

hboutemy avatar Sep 12 '15 08:09 hboutemy

IIRC @stephenc created this project originally, and though I didn't check the commits I'd say this was done on purpose to be able to just use directly the rule name with the class name.

And maybe also because the plan could be to try and move the successful rules to official Apache Maven's enforcer rules repo?

batmat avatar Sep 13 '15 19:09 batmat

The plan was to simplify usage (which you get with the "magic" package name) and migrate the successful ones to ASF (hence the code being ASL licensed)

I'm -1 on changing the package name, rather let's get the good ones over to ASF

Sent from my iPhone

On 13 Sep 2015, at 20:15, Baptiste Mathus [email protected] wrote:

IIRC @stephenc created this project originally, and though I didn't check the commits I'd say this was done on purpose to be able to just use directly the rule name with the class name.

And maybe also because the plan could be to try and move the successful rules to official Apache Maven's enforcer rules repo?

— Reply to this email directly or view it on GitHub.

stephenc avatar Sep 13 '15 20:09 stephenc

I'm not an enforcer code expert: if putting code in Apache Maven package is the only way of having usable rule names, I think enforcer needs a new feature to look for simple rule names in multiple packages Since we can't expect everybody putting his own code in Maven's package

this is independant from the good idea to move some rules to ASF if they are good (like enforce bytecode...)

hboutemy avatar Sep 13 '15 21:09 hboutemy

It's modello that makes the package name requirement.

Sent from my iPhone

On 13 Sep 2015, at 22:47, Hervé Boutemy [email protected] wrote:

I'm not an enforcer code expert: if putting code in Apache Maven package is the only way of having usable rule names, I think enforcer needs a new feature to look for simple rule names in multiple packages Since we can't expect everybody putting his own code in Maven's package

this is independant from the good idea to move some rules to ASF if they are good (like enforce bytecode...)

— Reply to this email directly or view it on GitHub.

stephenc avatar Sep 13 '15 22:09 stephenc

Modello? imposing some constraints on class loading scheme? I'm surprised. And I'm even more surprise that I didn't see any Modello model in enforcer code.

Can you elaborate, please?

hboutemy avatar Sep 13 '15 22:09 hboutemy

The classes in extra-enforcer are already in org/apache/maven/plugins/enforcer package...so no need to change the package name.

khmarbaise avatar Sep 14 '15 06:09 khmarbaise

Sorry, brain-fart, it was plexus configuration which by default uses the same package name as the generic type being injected

Sent from my iPhone

On 13 Sep 2015, at 23:49, Hervé Boutemy [email protected] wrote:

Modello? imposing some constraints on class loading scheme? I'm surprised. And I'm even more surprise that I didn't see any Modello model in enforcer code.

Can you elaborate, please?

— Reply to this email directly or view it on GitHub.

stephenc avatar Sep 14 '15 06:09 stephenc

@khmarbaise extra enforcer is not Apache: should not require to put classes in org/apache/maven/plugins/enforcer but in its own package: makes things more clear of course, this require Maven Enforcer to support such configuration...

hboutemy avatar Sep 14 '15 17:09 hboutemy

@hboutemy let's just see what rules are worthy of moving to ASF and then do the move. They are all ASL so should not be an issue

stephenc avatar Sep 14 '15 18:09 stephenc

moving some extra enforcer rules to Apache Enforcer won't change the problem with remaining ones: having extra-enforcer classes in same package than Enforcer itself is misleading

hboutemy avatar Sep 14 '15 22:09 hboutemy

problem is indeed plexus configuration, otherwise you need to add the implementation="path.to.the.Pojo" as attribute to the tag in case of a List. It would be nice if generics would be respected.

rfscholte avatar Sep 15 '15 20:09 rfscholte

The extra-enforcer-rules need to be included as a dependency to the maven-enforcer-plugin, maybe the maven-enforcer-plugin could scan it's direct dependencies for classes implementing EnforcerRule? Or would parsing the POM already choke due to the plexus configuration mentioned by @rfscholte?

mfriedenhagen avatar Nov 07 '15 21:11 mfriedenhagen

https://issues.apache.org/jira/browse/MENFORCER-367 issue reported to Maven Enforcer - even for me package name was misslending,

slachiewicz avatar Dec 29 '20 23:12 slachiewicz

Starting with enforcer 3.2.1 we can do it finally https://maven.apache.org/enforcer/enforcer-api/writing-a-custom-rule.html

slawekjaranowski avatar Feb 01 '23 23:02 slawekjaranowski

Will be resolved by #256

slawekjaranowski avatar May 18 '23 18:05 slawekjaranowski