Re: NPE in AbstractMavenReport.execute, because 'this.siteTool' is null
ok, Draft PR created https://github.com/dev-aspectj/aspectj-maven-plugin/pull/137 to easily reproduce and describe the issue then I analyzed more in depth, as commented in the PR: it seems you found a bug in Plugin Tools on inherited @Component injection we'll need to open a MPLUGIN issue and work there Regards, Hervé On 2023/10/11 02:11:09 Alexander Kriegisch wrote: > Hello Hervé. > > I am sorry, if my explanations were too complicated for you. I just > repeated everything from scratch for you, directly from my Git Bash > console: > > > > $ git clone https://github.com/dev-aspectj/aspectj-maven-plugin.git > Cloning into 'aspectj-maven-plugin'... > (...) > Resolving deltas: 100% (3585/3585), done. > > $ cd aspectj-maven-plugin/ > > $ nano src/main/java/org/codehaus/mojo/aspectj/AjcReportMojo.java > # Comment out the makeshift 'execute()' method, save file. > > $ mvn -Dinvoker.test=CreateReport verify -P integration-test > (...) > [INFO] --- invoker:3.6.0:run (integration-test) @ aspectj-maven-plugin --- > [INFO] Building: CreateReport\pom.xml > [INFO] run post-build script verify.groovy > [INFO] Assertion failed: > > assert indexFile.exists() > (...) > [INFO] CreateReport\pom.xml ... FAILED (14.36 s) > (...) > [INFO] BUILD FAILURE > (...) > > $ less target/it/CreateReport/build.log > # At the end of the file, there is the error. > # Scroll up a bit to see the Maven stacktrace. > > > > Hope this helps. > -- > Alexander Kriegisch > https://scrum-master.de > > > Herve Boutemy schrieb am 11.10.2023 00:27 (GMT +07:00): > > > I tried to build the project and see the failure, but could not > > and reading explanations did not help me > > > > what we need is a basic commit that works, followed by a PR upgrading Doxia > > and > > that does not work with the NPE that you are saying happens > > > > Regards, > > > > Hervé > > > > On 2023/10/10 02:44:08 Alexander Kriegisch wrote: > >> Reverting back to my original question, also summarised in the subject > >> of this thread: Why is 'this.siteTool' null and not injected properly? > >> If I knew how to fix that configuratively or via coding, I would no > >> longer need to override 'exceute()', which relies on that field being > >> set, as you can see in my original message's stack trace extract. > >> > >> Is there a bug in my project? Or is there one in Maven Reporting Tools? > >> > >> Regards > >> -- > >> Alexander Kriegisch > >> https://scrum-master.de > >> > >> > >> Alexander Kriegisch schrieb am 10.10.2023 09:28 (GMT +07:00): > >> > >> > Actually, my initial message already explained the situation: > >> > > >> > 1. With 1.x, I have no issues. That was my starting point. > >> > > >> > 2. With 2.0, I had no desire to verride 'execute()'. It was simply > >> > the only thing that helped my project to function properly again. > >> > I would be glad to do without it, especially given that fact that > >> > now the method has been marked final.But I am still failing to > >> > understand what I should do *instead*. It is nice that you > >> > "expect it to work", because so do I. But in fact, it does not. I > >> > gave you guys a reproducer to play with and exactly specified > >> > which commits to check out and which integration test to run in > >> > order to see both my situation before and after the ugly > >> > workaround of overriding 'execute()'. Maybe I missed the decisive > >> > hint in one of your messages, but for now, I have no idea how to > >> > fix my plugin without that ugly workaround. Probably there is a > >> > bug somewhere in the implementation in code I neither wrote nor > >> > ever touched, which is why I was asking for help here. Feel free > >> > to contact me off-list,if you think the noise is too much here. > >> > > >> > > >> > Michael Osipov schrieb am 09.10.2023 17:03 (GMT +07:00): > >> > > >> >> I had these NPEs when I started to migrate reporting plugins and both > >> >> the plugin and the super class contained the same fields which > >> >> created conflicts. After I have removed them from the plugin and used > >> >> the super ones all went fine. In your case I would really do what > >> >> Hervé proposes: > >> >> > >> >> * remove your execute() and retest with 1.x * in a branch try with > >> >> 2.x > >> >> > >> >> I expect it to work. You can also look at all of your reporting > >> >> plugins in branch doxia-2.0.0 you'll see all necessary migration > >> >> magic from me. The PR with finalizing the method is good and already > >> >> merged. > >> > >> - > >> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > >> For additional commands, e-mail: users-h...@maven.apache.org > >> > >> > > > > ---
Re: NPE in AbstractMavenReport.execute, because 'this.siteTool' is null
Hello Hervé. I am sorry, if my explanations were too complicated for you. I just repeated everything from scratch for you, directly from my Git Bash console: $ git clone https://github.com/dev-aspectj/aspectj-maven-plugin.git Cloning into 'aspectj-maven-plugin'... (...) Resolving deltas: 100% (3585/3585), done. $ cd aspectj-maven-plugin/ $ nano src/main/java/org/codehaus/mojo/aspectj/AjcReportMojo.java # Comment out the makeshift 'execute()' method, save file. $ mvn -Dinvoker.test=CreateReport verify -P integration-test (...) [INFO] --- invoker:3.6.0:run (integration-test) @ aspectj-maven-plugin --- [INFO] Building: CreateReport\pom.xml [INFO] run post-build script verify.groovy [INFO] Assertion failed: assert indexFile.exists() (...) [INFO] CreateReport\pom.xml ... FAILED (14.36 s) (...) [INFO] BUILD FAILURE (...) $ less target/it/CreateReport/build.log # At the end of the file, there is the error. # Scroll up a bit to see the Maven stacktrace. Hope this helps. -- Alexander Kriegisch https://scrum-master.de Herve Boutemy schrieb am 11.10.2023 00:27 (GMT +07:00): > I tried to build the project and see the failure, but could not > and reading explanations did not help me > > what we need is a basic commit that works, followed by a PR upgrading Doxia > and > that does not work with the NPE that you are saying happens > > Regards, > > Hervé > > On 2023/10/10 02:44:08 Alexander Kriegisch wrote: >> Reverting back to my original question, also summarised in the subject >> of this thread: Why is 'this.siteTool' null and not injected properly? >> If I knew how to fix that configuratively or via coding, I would no >> longer need to override 'exceute()', which relies on that field being >> set, as you can see in my original message's stack trace extract. >> >> Is there a bug in my project? Or is there one in Maven Reporting Tools? >> >> Regards >> -- >> Alexander Kriegisch >> https://scrum-master.de >> >> >> Alexander Kriegisch schrieb am 10.10.2023 09:28 (GMT +07:00): >> >> > Actually, my initial message already explained the situation: >> > >> > 1. With 1.x, I have no issues. That was my starting point. >> > >> > 2. With 2.0, I had no desire to verride 'execute()'. It was simply >> > the only thing that helped my project to function properly again. >> > I would be glad to do without it, especially given that fact that >> > now the method has been marked final.But I am still failing to >> > understand what I should do *instead*. It is nice that you >> > "expect it to work", because so do I. But in fact, it does not. I >> > gave you guys a reproducer to play with and exactly specified >> > which commits to check out and which integration test to run in >> > order to see both my situation before and after the ugly >> > workaround of overriding 'execute()'. Maybe I missed the decisive >> > hint in one of your messages, but for now, I have no idea how to >> > fix my plugin without that ugly workaround. Probably there is a >> > bug somewhere in the implementation in code I neither wrote nor >> > ever touched, which is why I was asking for help here. Feel free >> > to contact me off-list,if you think the noise is too much here. >> > >> > >> > Michael Osipov schrieb am 09.10.2023 17:03 (GMT +07:00): >> > >> >> I had these NPEs when I started to migrate reporting plugins and both >> >> the plugin and the super class contained the same fields which >> >> created conflicts. After I have removed them from the plugin and used >> >> the super ones all went fine. In your case I would really do what >> >> Hervé proposes: >> >> >> >> * remove your execute() and retest with 1.x * in a branch try with >> >> 2.x >> >> >> >> I expect it to work. You can also look at all of your reporting >> >> plugins in branch doxia-2.0.0 you'll see all necessary migration >> >> magic from me. The PR with finalizing the method is good and already >> >> merged. >> >> - >> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >> For additional commands, e-mail: users-h...@maven.apache.org >> >> > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: NPE in AbstractMavenReport.execute, because 'this.siteTool' is null
I tried to build the project and see the failure, but could not and reading explanations did not help me what we need is a basic commit that works, followed by a PR upgrading Doxia and that does not work with the NPE that you are saying happens Regards, Hervé On 2023/10/10 02:44:08 Alexander Kriegisch wrote: > Reverting back to my original question, also summarised in the subject > of this thread: Why is 'this.siteTool' null and not injected properly? > If I knew how to fix that configuratively or via coding, I would no > longer need to override 'exceute()', which relies on that field being > set, as you can see in my original message's stack trace extract. > > Is there a bug in my project? Or is there one in Maven Reporting Tools? > > Regards > -- > Alexander Kriegisch > https://scrum-master.de > > > Alexander Kriegisch schrieb am 10.10.2023 09:28 (GMT +07:00): > > > Actually, my initial message already explained the situation: > > > > 1. With 1.x, I have no issues. That was my starting point. > > > > 2. With 2.0, I had no desire to verride 'execute()'. It was simply > > the only thing that helped my project to function properly again. > > I would be glad to do without it, especially given that fact that > > now the method has been marked final.But I am still failing to > > understand what I should do *instead*. It is nice that you > > "expect it to work", because so do I. But in fact, it does not. I > > gave you guys a reproducer to play with and exactly specified > > which commits to check out and which integration test to run in > > order to see both my situation before and after the ugly > > workaround of overriding 'execute()'. Maybe I missed the decisive > > hint in one of your messages, but for now, I have no idea how to > > fix my plugin without that ugly workaround. Probably there is a > > bug somewhere in the implementation in code I neither wrote nor > > ever touched, which is why I was asking for help here. Feel free > > to contact me off-list,if you think the noise is too much here. > > > > > > Michael Osipov schrieb am 09.10.2023 17:03 (GMT +07:00): > > > >> I had these NPEs when I started to migrate reporting plugins and both > >> the plugin and the super class contained the same fields which > >> created conflicts. After I have removed them from the plugin and used > >> the super ones all went fine. In your case I would really do what > >> Hervé proposes: > >> > >> * remove your execute() and retest with 1.x * in a branch try with > >> 2.x > >> > >> I expect it to work. You can also look at all of your reporting > >> plugins in branch doxia-2.0.0 you'll see all necessary migration > >> magic from me. The PR with finalizing the method is good and already > >> merged. > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: NPE in AbstractMavenReport.execute, because 'this.siteTool' is null
Reverting back to my original question, also summarised in the subject of this thread: Why is 'this.siteTool' null and not injected properly? If I knew how to fix that configuratively or via coding, I would no longer need to override 'exceute()', which relies on that field being set, as you can see in my original message's stack trace extract. Is there a bug in my project? Or is there one in Maven Reporting Tools? Regards -- Alexander Kriegisch https://scrum-master.de Alexander Kriegisch schrieb am 10.10.2023 09:28 (GMT +07:00): > Actually, my initial message already explained the situation: > > 1. With 1.x, I have no issues. That was my starting point. > > 2. With 2.0, I had no desire to verride 'execute()'. It was simply > the only thing that helped my project to function properly again. > I would be glad to do without it, especially given that fact that > now the method has been marked final.But I am still failing to > understand what I should do *instead*. It is nice that you > "expect it to work", because so do I. But in fact, it does not. I > gave you guys a reproducer to play with and exactly specified > which commits to check out and which integration test to run in > order to see both my situation before and after the ugly > workaround of overriding 'execute()'. Maybe I missed the decisive > hint in one of your messages, but for now, I have no idea how to > fix my plugin without that ugly workaround. Probably there is a > bug somewhere in the implementation in code I neither wrote nor > ever touched, which is why I was asking for help here. Feel free > to contact me off-list,if you think the noise is too much here. > > > Michael Osipov schrieb am 09.10.2023 17:03 (GMT +07:00): > >> I had these NPEs when I started to migrate reporting plugins and both >> the plugin and the super class contained the same fields which >> created conflicts. After I have removed them from the plugin and used >> the super ones all went fine. In your case I would really do what >> Hervé proposes: >> >> * remove your execute() and retest with 1.x * in a branch try with >> 2.x >> >> I expect it to work. You can also look at all of your reporting >> plugins in branch doxia-2.0.0 you'll see all necessary migration >> magic from me. The PR with finalizing the method is good and already >> merged. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: NPE in AbstractMavenReport.execute, because 'this.siteTool' is null
Actually, my initial message already explained the situation: 1. With 1.x, I have no issues. That was my starting point. 2. With 2.0, I had no desire to verride 'execute()'. It was simply the only thing that helped my project to function properly again. I would be glad to do without it, especially given that fact that now the method has been marked final.But I am still failing to understand what I should do *instead*. It is nice that you "expect it to work", because so do I. But in fact, it does not. I gave you guys a reproducer to play with and exactly specified which commits to check out and which integration test to run in order to see both my situation before and after the ugly workaround of overriding 'execute()'. Maybe I missed the decisive hint in one of your messages, but for now, I have no idea how to fix my plugin without that ugly workaround. Probably there is a bug somewhere in the implementation in code I neither wrote nor ever touched, which is why I was asking for help here. Feel free to contact me off-list,if you think the noise is too much here. Best regards -- Alexander Kriegisch https://scrum-master.de Michael Osipov schrieb am 09.10.2023 17:03 (GMT +07:00): > I had these NPEs when I started to migrate reporting plugins and both the > plugin and the super class contained the same fields which created conflicts. > After I have removed them from the plugin and used the super ones all went > fine. In your case I would really do what Hervé proposes: > > * remove your execute() and retest with 1.x > * in a branch try with 2.x > > I expect it to work. You can also look at all of your reporting plugins in > branch doxia-2.0.0 you'll see all necessary migration magic from me. The PR > with finalizing the method is good and already merged. > > M > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: NPE in AbstractMavenReport.execute, because 'this.siteTool' is null
I had these NPEs when I started to migrate reporting plugins and both the plugin and the super class contained the same fields which created conflicts. After I have removed them from the plugin and used the super ones all went fine. In your case I would really do what Hervé proposes: * remove your execute() and retest with 1.x * in a branch try with 2.x I expect it to work. You can also look at all of your reporting plugins in branch doxia-2.0.0 you'll see all necessary migration magic from me. The PR with finalizing the method is good and already merged. M - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: NPE in AbstractMavenReport.execute, because 'this.siteTool' is null
On 2023/10/05 06:46:02 Hervé Boutemy wrote: > improvement proposed: review appreciated > https://github.com/apache/maven-reporting-impl/pull/24 Will try to look at the issue here and the proposed PR in the next couple of days... - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: NPE in AbstractMavenReport.execute, because 'this.siteTool' is null
improvement proposed: review appreciated https://github.com/apache/maven-reporting-impl/pull/24 Le mercredi 4 octobre 2023, 08:30:04 CEST Hervé Boutemy a écrit : > Hi Xander, > > Sorry, I lost track, having a look now. > > When I see that you are implementing Mojo's "execute()" [1] while using > maven-reporting-impl, you are in fact defeating the objective of > maven-reporting-impl: do that for you. > > maven-reporting-impl would probably need better documentation, I need help, > but the IT [2] tries to show how to write such reporting code that can be > run both as goal and a maven-site's report > > And if you want to see how it does the job, you can look at > maven-reporting-impl AbstractMavenReport implementation of execute() [3]: > yes, that implementation changed, and now I remember I had to update it > because of the NPE that it could cause. You must not rewrite this code. > > HTH > > Hervé > > > [1] > https://github.com/dev-aspectj/aspectj-maven-plugin/blob/main/src/main/java > /org/codehaus/mojo/aspectj/AjcReportMojo.java#L210 > > [2] > https://github.com/apache/maven-reporting-impl/tree/master/src/it/setup-rep > orting-plugin/src/main/java/org/apache/maven/reporting/its/custom > > [3] > https://github.com/apache/maven-reporting-impl/blob/master/src/main/java/or > g/apache/maven/reporting/AbstractMavenReport.java#L187 > Le mercredi 4 octobre 2023, 04:05:58 CEST Alexander Kriegisch a écrit : > > Hello Hervé. > > > > Did the reproducer help you in any way? > > > > Regards > > > > > Hello Hervé. > > > > > >>> I tried to upgrade those > > >>> dependencies to the most recent Doxia and Sitetools versions. > > >> > > >> by "most recent", do you mean most recent from 1.x or 2.0.0-M*? > > > > > > I mean 2.0.0-M*. Actually, the project works nicely and I would have > > > ignored the Dependabot suggestions, but all those Maven warnings about > > > outdated or EOL components made me start upgrading them. I was under the > > > impression that Doxia milestones are just as stable and production-ready > > > as Surefire ones, so I did not think much and gaven them a go. > > > > > >> 1.x should not cause issues > > >> > > >> 2.0.0-M*, as expected from the version number, is more risky and not > > >> yet > > >> fully > > >> > > >> stable > > > > > > Then maybe it is better to revert to 1.x and let users live live with > > > the > > > Plexus warnings for a little longer. > > > > > >> Such reporting plugin coding has so many ways to be done that sharing a > > >> reproducer is the easiest way to have concrete view on what is > > >> happening, > > >> particularly if you're going to 2.0.0-M* > > > > > > Sure, it is about https://github.com/dev-aspectj/aspectj-maven-plugin. > > > > > > On the main branch, > > > > > > -- an older commit like 93110452 shows the (stable) situation before I > > > > > > started various and sundry plugins and dependencies, > > > > > > -- second-latest commit 7b8706a7 - see also build > > > > > > https://github.com/dev-aspectj/aspectj-maven-plugin/actions/runs/62 > > > 30 > > > 950536 > > > - shows an intermediate step in which the plugin's reporting > > > goalfails in integration tests, > > > > > > -- latest commit 1a819a4e stabilises the integration tests, but is a > > > > > > hacky work-in-progress commit that needs to be cleaned up. You > > > asked for a reproducer, so I pushed the commit. > > > > > > You can build the plugin quickly, if you deactivate the > > > 'integration-test' profile. In order to reproduce the problem, run > > > something like > > > > > > mvn -Dinvoker.test=CreateReport verify -P integration-test > > > > > > on the lat6est commit, but locally revert this change in > > > AjcReportMojo.java: > > > https://github.com/dev-aspectj/aspectj-maven-plugin/commit/1a819a4e0b2c3 > > > c > > > d34797c3122488ea5833cf9fd5#diff-64f2431d9507f2996b65ccf8f9a4e202923d456e > > > 31 > > > 579f3809ef4d648509b62e > > > > > > Regards > > > -- > > > Xander > > > https://scrum-master.de > > > > > >> Le jeudi 7 septembre 2023, 04:35:29 CEST Alexander Kriegisch a écrit : > > >>> Hello Maven community. > > >>> > > >>> In a Maven plugin using old 1.x Doxia and Sitetool versions, I am > > >>> getting > > >>> warnings because those again use an EOL Plexus component. The details > > >>> are > > >>> not so important, the important part is that I tried to upgrade those > > >>> dependencies to the most recent Doxia and Sitetools versions. > > >>> > > >>> One class in the plugin extends > > >>> org.apache.maven.reporting.AbstractMavenReport. It implements an > > >>> executeReport(Locale) method, which so far was fine. But now, it also > > >>> inherits execute() from the abstract parent class. The latter method > > >>> is > > >>> always called when using the reporting goal for my plugin. The result > > >>> is > > >>> an > > >>> > > >>> error like this: > > >>> Caused by: java.lang.NullPointerException: Cannot invok
Re: NPE in AbstractMavenReport.execute, because 'this.siteTool' is null
Hi Xander, Sorry, I lost track, having a look now. When I see that you are implementing Mojo's "execute()" [1] while using maven-reporting-impl, you are in fact defeating the objective of maven-reporting-impl: do that for you. maven-reporting-impl would probably need better documentation, I need help, but the IT [2] tries to show how to write such reporting code that can be run both as goal and a maven-site's report And if you want to see how it does the job, you can look at maven-reporting-impl AbstractMavenReport implementation of execute() [3]: yes, that implementation changed, and now I remember I had to update it because of the NPE that it could cause. You must not rewrite this code. HTH Hervé [1] https://github.com/dev-aspectj/aspectj-maven-plugin/blob/main/src/main/java/org/codehaus/mojo/aspectj/AjcReportMojo.java#L210 [2] https://github.com/apache/maven-reporting-impl/tree/master/src/it/setup-reporting-plugin/src/main/java/org/apache/maven/reporting/its/custom [3] https://github.com/apache/maven-reporting-impl/blob/master/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java#L187 Le mercredi 4 octobre 2023, 04:05:58 CEST Alexander Kriegisch a écrit : > Hello Hervé. > > Did the reproducer help you in any way? > > Regards > > > Hello Hervé. > > > >>> I tried to upgrade those > >>> dependencies to the most recent Doxia and Sitetools versions. > >> > >> by "most recent", do you mean most recent from 1.x or 2.0.0-M*? > > > > I mean 2.0.0-M*. Actually, the project works nicely and I would have > > ignored the Dependabot suggestions, but all those Maven warnings about > > outdated or EOL components made me start upgrading them. I was under the > > impression that Doxia milestones are just as stable and production-ready > > as Surefire ones, so I did not think much and gaven them a go. > > > >> 1.x should not cause issues > >> > >> 2.0.0-M*, as expected from the version number, is more risky and not yet > >> fully > >> > >> stable > > > > Then maybe it is better to revert to 1.x and let users live live with the > > Plexus warnings for a little longer. > > > >> Such reporting plugin coding has so many ways to be done that sharing a > >> reproducer is the easiest way to have concrete view on what is happening, > >> particularly if you're going to 2.0.0-M* > > > > Sure, it is about https://github.com/dev-aspectj/aspectj-maven-plugin. > > > > On the main branch, > > > > -- an older commit like 93110452 shows the (stable) situation before I > > > > started various and sundry plugins and dependencies, > > > > -- second-latest commit 7b8706a7 - see also build > > > > https://github.com/dev-aspectj/aspectj-maven-plugin/actions/runs/6230 > > 950536 > > - shows an intermediate step in which the plugin's reporting > > goalfails in integration tests, > > > > -- latest commit 1a819a4e stabilises the integration tests, but is a > > > > hacky work-in-progress commit that needs to be cleaned up. You > > asked for a reproducer, so I pushed the commit. > > > > You can build the plugin quickly, if you deactivate the > > 'integration-test' profile. In order to reproduce the problem, run > > something like > > > > mvn -Dinvoker.test=CreateReport verify -P integration-test > > > > on the lat6est commit, but locally revert this change in > > AjcReportMojo.java: > > https://github.com/dev-aspectj/aspectj-maven-plugin/commit/1a819a4e0b2c3c > > d34797c3122488ea5833cf9fd5#diff-64f2431d9507f2996b65ccf8f9a4e202923d456e31 > > 579f3809ef4d648509b62e > > > > Regards > > -- > > Xander > > https://scrum-master.de > > > >> Le jeudi 7 septembre 2023, 04:35:29 CEST Alexander Kriegisch a écrit : > >>> Hello Maven community. > >>> > >>> In a Maven plugin using old 1.x Doxia and Sitetool versions, I am > >>> getting > >>> warnings because those again use an EOL Plexus component. The details > >>> are > >>> not so important, the important part is that I tried to upgrade those > >>> dependencies to the most recent Doxia and Sitetools versions. > >>> > >>> One class in the plugin extends > >>> org.apache.maven.reporting.AbstractMavenReport. It implements an > >>> executeReport(Locale) method, which so far was fine. But now, it also > >>> inherits execute() from the abstract parent class. The latter method is > >>> always called when using the reporting goal for my plugin. The result is > >>> an > >>> > >>> error like this: > >>> Caused by: java.lang.NullPointerException: Cannot invoke > >>> > >>> "org.apache.maven.doxia.tools.SiteTool.getSiteLocales(String)" because > >>> "this.siteTool" is null at > >>> org.apache.maven.reporting.AbstractMavenReport.getLocale > >>> (AbstractMavenReport.java:400) at > >>> org.apache.maven.reporting.AbstractMavenReport.reportToMarkup > >>> (AbstractMavenReport.java:212) at > >>> org.apache.maven.reporting.AbstractMavenReport.execute > >>> (AbstractMavenReport.java:189) > >>> > >>> I see that AbstractMav
Re: NPE in AbstractMavenReport.execute, because 'this.siteTool' is null
Hello Hervé. Did the reproducer help you in any way? Regards -- Alexander Kriegisch https://scrum-master.de Alexander Kriegisch schrieb am 23.09.2023 10:00 (GMT +07:00): > Hello Hervé. > >>> I tried to upgrade those >>> dependencies to the most recent Doxia and Sitetools versions. > >> by "most recent", do you mean most recent from 1.x or 2.0.0-M*? > > I mean 2.0.0-M*. Actually, the project works nicely and I would have > ignored the Dependabot suggestions, but all those Maven warnings about > outdated or EOL components made me start upgrading them. I was under the > impression that Doxia milestones are just as stable and production-ready > as Surefire ones, so I did not think much and gaven them a go. > >> 1.x should not cause issues >> >> 2.0.0-M*, as expected from the version number, is more risky and not yet >> fully >> >> stable > > Then maybe it is better to revert to 1.x and let users live live with the > Plexus warnings for a little longer. > >> Such reporting plugin coding has so many ways to be done that sharing a >> reproducer is the easiest way to have concrete view on what is happening, >> particularly if you're going to 2.0.0-M* > > Sure, it is about https://github.com/dev-aspectj/aspectj-maven-plugin. > > On the main branch, > -- an older commit like 93110452 shows the (stable) situation before I > started various and sundry plugins and dependencies, > -- second-latest commit 7b8706a7 - see also build > > https://github.com/dev-aspectj/aspectj-maven-plugin/actions/runs/6230950536 > - shows an intermediate step in which the plugin's reporting > goalfails in integration tests, > -- latest commit 1a819a4e stabilises the integration tests, but is a > hacky work-in-progress commit that needs to be cleaned up. You > asked for a reproducer, so I pushed the commit. > > You can build the plugin quickly, if you deactivate the > 'integration-test' profile. In order to reproduce the problem, run > something like > > mvn -Dinvoker.test=CreateReport verify -P integration-test > > on the lat6est commit, but locally revert this change in AjcReportMojo.java: > https://github.com/dev-aspectj/aspectj-maven-plugin/commit/1a819a4e0b2c3cd34797c3122488ea5833cf9fd5#diff-64f2431d9507f2996b65ccf8f9a4e202923d456e31579f3809ef4d648509b62e > > Regards > -- > Xander > https://scrum-master.de > > >> Le jeudi 7 septembre 2023, 04:35:29 CEST Alexander Kriegisch a écrit : >>> Hello Maven community. >>> >>> In a Maven plugin using old 1.x Doxia and Sitetool versions, I am getting >>> warnings because those again use an EOL Plexus component. The details are >>> not so important, the important part is that I tried to upgrade those >>> dependencies to the most recent Doxia and Sitetools versions. >>> >>> One class in the plugin extends >>> org.apache.maven.reporting.AbstractMavenReport. It implements an >>> executeReport(Locale) method, which so far was fine. But now, it also >>> inherits execute() from the abstract parent class. The latter method is >>> always called when using the reporting goal for my plugin. The result is an >>> error like this: >>> >>> Caused by: java.lang.NullPointerException: Cannot invoke >>> "org.apache.maven.doxia.tools.SiteTool.getSiteLocales(String)" because >>> "this.siteTool" is null at >>> org.apache.maven.reporting.AbstractMavenReport.getLocale >>> (AbstractMavenReport.java:400) at >>> org.apache.maven.reporting.AbstractMavenReport.reportToMarkup >>> (AbstractMavenReport.java:212) at >>> org.apache.maven.reporting.AbstractMavenReport.execute >>> (AbstractMavenReport.java:189) >>> >>> I see that AbstractMavenReport defines the 'siteTool' field as follows: >>> >>> @Component >>> protected SiteTool siteTool; >>> >>> I am wondering why that field is null. Should it not be populated >>> automatically by dependency injection? I have a dirty workaround for this >>> problem: >>> >>> @Override >>> public void execute() throws MojoExecutionException { >>> //super.execute(); >>> try { >>> executeReport(Locale.getDefault()); >>> } >>> catch (MavenReportException e) { >>> throw new MojoExecutionException(e); >>> } >>> } >>> >>> This way, 'siteTool' is not used and method SiteTool.getSiteLocales(String) >>> never called. But I guess, that is not a good solution to the problem. How >>> are plugin implementors meant to deal with this situation? Or is this some >>> kind of bug? I am unsure how to proceed. I am by no means a Maven plugin >>> buff and merely helping to keep an existing plugin alive. I would be >>> grateful for hints. >>> >>> Regards >> >> >> >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >> For additional commands, e-mail: users-h...@maven.apache.org >> >> > > - > To unsubscribe, e-mail: users-unsubscr.
Re: NPE in AbstractMavenReport.execute, because 'this.siteTool' is null
Hello Hervé. >> I tried to upgrade those >> dependencies to the most recent Doxia and Sitetools versions. > by "most recent", do you mean most recent from 1.x or 2.0.0-M*? I mean 2.0.0-M*. Actually, the project works nicely and I would have ignored the Dependabot suggestions, but all those Maven warnings about outdated or EOL components made me start upgrading them. I was under the impression that Doxia milestones are just as stable and production-ready as Surefire ones, so I did not think much and gaven them a go. > 1.x should not cause issues > > 2.0.0-M*, as expected from the version number, is more risky and not yet > fully > stable Then maybe it is better to revert to 1.x and let users live live with the Plexus warnings for a little longer. > Such reporting plugin coding has so many ways to be done that sharing a > reproducer is the easiest way to have concrete view on what is happening, > particularly if you're going to 2.0.0-M* Sure, it is about https://github.com/dev-aspectj/aspectj-maven-plugin. On the main branch, -- an older commit like 93110452 shows the (stable) situation before I started various and sundry plugins and dependencies, -- second-latest commit 7b8706a7 - see also build https://github.com/dev-aspectj/aspectj-maven-plugin/actions/runs/6230950536 - shows an intermediate step in which the plugin's reporting goalfails in integration tests, -- latest commit 1a819a4e stabilises the integration tests, but is a hacky work-in-progress commit that needs to be cleaned up. You asked for a reproducer, so I pushed the commit. You can build the plugin quickly, if you deactivate the 'integration-test' profile. In order to reproduce the problem, run something like mvn -Dinvoker.test=CreateReport verify -P integration-test on the lat6est commit, but locally revert this change in AjcReportMojo.java: https://github.com/dev-aspectj/aspectj-maven-plugin/commit/1a819a4e0b2c3cd34797c3122488ea5833cf9fd5#diff-64f2431d9507f2996b65ccf8f9a4e202923d456e31579f3809ef4d648509b62e Regards -- Xander https://scrum-master.de > Le jeudi 7 septembre 2023, 04:35:29 CEST Alexander Kriegisch a écrit : >> Hello Maven community. >> >> In a Maven plugin using old 1.x Doxia and Sitetool versions, I am getting >> warnings because those again use an EOL Plexus component. The details are >> not so important, the important part is that I tried to upgrade those >> dependencies to the most recent Doxia and Sitetools versions. >> >> One class in the plugin extends >> org.apache.maven.reporting.AbstractMavenReport. It implements an >> executeReport(Locale) method, which so far was fine. But now, it also >> inherits execute() from the abstract parent class. The latter method is >> always called when using the reporting goal for my plugin. The result is an >> error like this: >> >> Caused by: java.lang.NullPointerException: Cannot invoke >> "org.apache.maven.doxia.tools.SiteTool.getSiteLocales(String)" because >> "this.siteTool" is null at >> org.apache.maven.reporting.AbstractMavenReport.getLocale >> (AbstractMavenReport.java:400) at >> org.apache.maven.reporting.AbstractMavenReport.reportToMarkup >> (AbstractMavenReport.java:212) at >> org.apache.maven.reporting.AbstractMavenReport.execute >> (AbstractMavenReport.java:189) >> >> I see that AbstractMavenReport defines the 'siteTool' field as follows: >> >> @Component >> protected SiteTool siteTool; >> >> I am wondering why that field is null. Should it not be populated >> automatically by dependency injection? I have a dirty workaround for this >> problem: >> >> @Override >> public void execute() throws MojoExecutionException { >> //super.execute(); >> try { >> executeReport(Locale.getDefault()); >> } >> catch (MavenReportException e) { >> throw new MojoExecutionException(e); >> } >> } >> >> This way, 'siteTool' is not used and method SiteTool.getSiteLocales(String) >> never called. But I guess, that is not a good solution to the problem. How >> are plugin implementors meant to deal with this situation? Or is this some >> kind of bug? I am unsure how to proceed. I am by no means a Maven plugin >> buff and merely helping to keep an existing plugin alive. I would be >> grateful for hints. >> >> Regards > > > > > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > > - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: NPE in AbstractMavenReport.execute, because 'this.siteTool' is null
> I tried to upgrade those > dependencies to the most recent Doxia and Sitetools versions. by "most recent", do you mean most recent from 1.x or 2.0.0-M*? 1.x should not cause issues 2.0.0-M*, as expected from the version number, is more risky and not yet fully stable Such reporting plugin coding has so many ways to be done that sharing a reproducer is the easiest way to have concrete view on what is happening, particularly if you're going to 2.0.0-M* Regards, Hervé Le jeudi 7 septembre 2023, 04:35:29 CEST Alexander Kriegisch a écrit : > Hello Maven community. > > In a Maven plugin using old 1.x Doxia and Sitetool versions, I am getting > warnings because those again use an EOL Plexus component. The details are > not so important, the important part is that I tried to upgrade those > dependencies to the most recent Doxia and Sitetools versions. > > One class in the plugin extends > org.apache.maven.reporting.AbstractMavenReport. It implements an > executeReport(Locale) method, which so far was fine. But now, it also > inherits execute() from the abstract parent class. The latter method is > always called when using the reporting goal for my plugin. The result is an > error like this: > > Caused by: java.lang.NullPointerException: Cannot invoke > "org.apache.maven.doxia.tools.SiteTool.getSiteLocales(String)" because > "this.siteTool" is null at > org.apache.maven.reporting.AbstractMavenReport.getLocale > (AbstractMavenReport.java:400) at > org.apache.maven.reporting.AbstractMavenReport.reportToMarkup > (AbstractMavenReport.java:212) at > org.apache.maven.reporting.AbstractMavenReport.execute > (AbstractMavenReport.java:189) > > I see that AbstractMavenReport defines the 'siteTool' field as follows: > > @Component > protected SiteTool siteTool; > > I am wondering why that field is null. Should it not be populated > automatically by dependency injection? I have a dirty workaround for this > problem: > > @Override > public void execute() throws MojoExecutionException { > //super.execute(); > try { > executeReport(Locale.getDefault()); > } > catch (MavenReportException e) { > throw new MojoExecutionException(e); > } > } > > This way, 'siteTool' is not used and method SiteTool.getSiteLocales(String) > never called. But I guess, that is not a good solution to the problem. How > are plugin implementors meant to deal with this situation? Or is this some > kind of bug? I am unsure how to proceed. I am by no means a Maven plugin > buff and merely helping to keep an existing plugin alive. I would be > grateful for hints. > > Regards - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: NPE in AbstractMavenReport.execute, because 'this.siteTool' is null
Hello. I was asking this question two weeks ago. Can somebody tell me if maybe I asked on the wrong list or in the wrong way and possible direct me elsewhere? Thank you all. Best regards -- Alexander Kriegisch https://scrum-master.de Alexander Kriegisch schrieb am 07.09.2023 09:35 (GMT +07:00): > Hello Maven community. > > In a Maven plugin using old 1.x Doxia and Sitetool versions, I am getting > warnings because those again use an EOL Plexus component. The details are not > so important, the important part is that I tried to upgrade those dependencies > to the most recent Doxia and Sitetools versions. > > One class in the plugin extends > org.apache.maven.reporting.AbstractMavenReport. > It implements an executeReport(Locale) method, which so far was fine. But now, > it also inherits execute() from the abstract parent class. The latter method > is > always called when using the reporting goal for my plugin. The result is an > error like this: > > Caused by: java.lang.NullPointerException: Cannot invoke > "org.apache.maven.doxia.tools.SiteTool.getSiteLocales(String)" because > "this.siteTool" is null > at org.apache.maven.reporting.AbstractMavenReport.getLocale > (AbstractMavenReport.java:400) > at org.apache.maven.reporting.AbstractMavenReport.reportToMarkup > (AbstractMavenReport.java:212) > at org.apache.maven.reporting.AbstractMavenReport.execute > (AbstractMavenReport.java:189) > > I see that AbstractMavenReport defines the 'siteTool' field as follows: > > @Component > protected SiteTool siteTool; > > I am wondering why that field is null. Should it not be populated > automatically > by dependency injection? I have a dirty workaround for this problem: > > @Override > public void execute() throws MojoExecutionException { > //super.execute(); > try { > executeReport(Locale.getDefault()); > } > catch (MavenReportException e) { > throw new MojoExecutionException(e); > } > } > > This way, 'siteTool' is not used and method SiteTool.getSiteLocales(String) > never called. But I guess, that is not a good solution to the problem. How are > plugin implementors meant to deal with this situation? Or is this some kind of > bug? I am unsure how to proceed. I am by no means a Maven plugin buff and > merely helping to keep an existing plugin alive. I would be grateful for > hints. > > Regards - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
NPE in AbstractMavenReport.execute, because 'this.siteTool' is null
Hello Maven community. In a Maven plugin using old 1.x Doxia and Sitetool versions, I am getting warnings because those again use an EOL Plexus component. The details are not so important, the important part is that I tried to upgrade those dependencies to the most recent Doxia and Sitetools versions. One class in the plugin extends org.apache.maven.reporting.AbstractMavenReport. It implements an executeReport(Locale) method, which so far was fine. But now, it also inherits execute() from the abstract parent class. The latter method is always called when using the reporting goal for my plugin. The result is an error like this: Caused by: java.lang.NullPointerException: Cannot invoke "org.apache.maven.doxia.tools.SiteTool.getSiteLocales(String)" because "this.siteTool" is null at org.apache.maven.reporting.AbstractMavenReport.getLocale (AbstractMavenReport.java:400) at org.apache.maven.reporting.AbstractMavenReport.reportToMarkup (AbstractMavenReport.java:212) at org.apache.maven.reporting.AbstractMavenReport.execute (AbstractMavenReport.java:189) I see that AbstractMavenReport defines the 'siteTool' field as follows: @Component protected SiteTool siteTool; I am wondering why that field is null. Should it not be populated automatically by dependency injection? I have a dirty workaround for this problem: @Override public void execute() throws MojoExecutionException { //super.execute(); try { executeReport(Locale.getDefault()); } catch (MavenReportException e) { throw new MojoExecutionException(e); } } This way, 'siteTool' is not used and method SiteTool.getSiteLocales(String) never called. But I guess, that is not a good solution to the problem. How are plugin implementors meant to deal with this situation? Or is this some kind of bug? I am unsure how to proceed. I am by no means a Maven plugin buff and merely helping to keep an existing plugin alive. I would be grateful for hints. Regards -- Alexander Kriegisch https://scrum-master.de - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org