webfx-project / webfx-cli

The Command Line Interface for WebFX. The terminal tool for developing WebFX applications.
https://webfx.dev
Apache License 2.0
10 stars 3 forks source link

Update for maven plugin #6

Closed AlexBelchUK closed 1 year ago

salmonb commented 1 year ago

Thanks for spotting the issue with ResourceTextFileReader. Your PR prevents the NPE that is happening when invoking the CLI from the maven plugin, however the resources such as the templates are still not correctly loaded according to my tests. The only solution I found so far that works both in the CLI and in the Maven plugin is to ask the WebFxCLI class to load the resources and always pass relative paths to it (absolute paths don't seem to work in the context of the Maven plugin for any reason).

Regarding the other changes (replacing inferred types with explicit types), they don't seem necessary to make the Maven plugin work according to my tests.

So I pushed the solution I mentioned above to the main branch (at this time of writing I think I should have created another branch... anyway it's too late).

Could you please check out this new version and confirm that the Maven plugin works with it? Then we will focus on the maven plugin itself. Thank you.

AlexBelchUK commented 1 year ago
Hi Bruno, I’ve re-sync’d and built using the mvn command line for the webfx-cli project, all looks okay,I’ve updated the README.md on the webfx-maven-plugin project to add info on how to build and run on the command line from within a maven project. To test the template resource reading... 1. I created a ‘dummy’ project using command line:     mkdir webfx-example    cd webfx-example    webfx init org.example:webfx-example:1.0.0-SNAPSHOT 2. Inside the project, I tested template resource reading fixes by re-generating the same hello world project but via the mvn command (the command line below required a pre-existing pom.xml to work):mvn -Dargs=”init,org.example:webFX-example:1.0.0-SNAPSHOT” dev.webfx:webfx-maven-plugin:cli 3. I also tested the create application using mvn command (no spaces between commas in args) :mvn -Dargs="create,application,--prefix,webfx-example,org.example.webfxexample.WebFxExampleApplication,--helloWorld" dev.webfx:webfx-maven-plugin:cli        and that ran ok. The other webfx-cli code fixes ...I found that the code without my changes built on the command line, however when importing into Eclipse IDE, without my fixes I got a set of errors – maybe an Eclipse bug / config / source version issue. I’ve attached a screenshot below just for info (I may try another IDE at some point but will live with my patches locally for now)   Alex  Sent from Mail for Windows From: Bruno SalmonSent: 18 March 2023 21:36To: webfx-project/webfx-cliCc: Alex; AuthorSubject: Re: [webfx-project/webfx-cli] Update for maven plugin (PR #6) Thanks for spotting the issue with ResourceTextFileReader. Your PR prevents the NPE that is happening when invoking the CLI from the maven plugin, however the resources such as the templates are still not correctly loaded according to my tests. The only solution I found so far that works both in the CLI and in the Maven plugin is to ask the WebFxCLI class to load the resources and always pass relative paths to it (absolute paths don't seem to work in the context of the Maven plugin for any reason).Regarding the other changes (replacing inferred types with explicit types), they don't seem necessary to make the Maven plugin work according to my tests.So I pushed the solution I mentioned above to the main branch (at this time of writing I think I should have created another branch... anyway it's too late).Could you please check out this new version and confirm that the Maven plugin works with it?Then we will focus on the maven plugin itself.Thank you.—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***> 
salmonb commented 1 year ago

The issue raised by Alex with ResourceTextFileReader when called from Maven is already fixed in the main branch. So I'm closing this PR.