apache / apache/maven-enforcer

[MENFORCER-473] Custom Rules are not processed with Java 17

Open
#837 10 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
161
Forks
180
Avg merge
1d 20m
Merged PRs (30d)
8

Description

**[Nils Christian Ehmke](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=nils)** opened **[MENFORCER-473](https://issues.apache.org/jira/browse/MENFORCER-473?redirect=false)** and commented

Hi,

We noticed that our custom rule, using the newer API (as documented [here)](https://maven.apache.org/enforcer/enforcer-api/writing-a-custom-rule.html) is not processed using Java 17.

We created a sample project using the custom rule example. Once we use Java 17 in the pom.xml it breaks.

```java

3.2.1
3.9.0

17
17

...

org.apache.maven.plugins
maven-compiler-plugin
3.11.0


org.eclipse.sisu
sisu-maven-plugin
0.9.0.M1



main-index


```

If we compile the custom rule and verify the using project, we get

```
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.2.1:enforce (enforce) on project maven-enforcer-plugin-sample-usage: Execution enforce of goal org.apache.maven.plugins:maven-enforcer-plugin:3.2.1:enforce failed: Failed to create enforcer rules with name: myCustomRule or for class: org.apache.maven.plugins.enforcer.MyCustomRule -> [Help 1]
```

The index file itself looks good, so something else within the plugin or Sisu Plexus seems to break.

---

**Affects:** 3.2.1

**Issue Links:**
- [MNG-7587](https://issues.apache.org/jira/browse/MNG-7587) Update Sisu to a version supporting at least Java 17
(_**"is blocked by"**_)
- [MNG-7913](https://issues.apache.org/jira/browse/MNG-7913) Upgrade Sisu version to 0.9.0.M2

**Remote Links:**
- [GitHub Pull Request #264
](https://github.com/apache/maven-enforcer/pull/264)

1 votes, 6 watchers

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the custom rule example and its pom.xml, using the Java 17 configuration and the reported Maven Enforcer command to reproduce the failure. Inspect the generated Sisu index file and the related Maven Enforcer/Sisu integration; done means the documented custom rule is processed successfully on Java 17.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.