maven-hpi-plugin icon indicating copy to clipboard operation
maven-hpi-plugin copied to clipboard

Handle presence of index.jelly differently

Open twasyl opened this issue 2 years ago • 6 comments

Signed-off-by: Thierry Wasylczenko [email protected]

Currently if there is no src/main/resources/index.jelly file in the Jenkins plugin sources, mvn hpi:run will fail the build indicating the file must be created using the POM's <description>. This behaviour has been introduced in #302. As I like to enforce the creation of index.jelly, the current approach:

  • assumes there is a <description> in the POM
  • lead to think you have to delete the <description> from your POM

IMO this could be improved for plugins author's UX. If the description is present but the the file is not, I assume the author:

  • doesn't need to create a file when it's content is predictive (because we have the description)
  • doesn't want the content of index.jelly to be different from the description

This PR aims to provide the following behaviours:

  • In case the index.jelly file doesn't exist and the description is provided, create the file under target/classes and log a warning

  • In case the index.jelly file doesn't exist and the description is not provided, then throw an error to enforce the creation of the file by the author

  • In case the index.jelly file is provided, use it

  • [x] Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!

  • [x] Ensure that the pull request title represents the desired changelog entry

  • [x] Please describe what you did

  • [ ] Link to relevant issues in GitHub or Jira

  • [x] Link to relevant pull requests, esp. upstream and downstream changes

  • [x] Ensure you have provided tests - that demonstrates feature works or fixes the issue

twasyl avatar Jun 02 '22 08:06 twasyl

I'm not at ease thinking that hpi:hpi can somehow write under src/ directory.

Such goal should always be reproducible, and here if you call it twice, the first call will fail, and the second one will succeed.

Adding a separate goal to implement such behaviour would be acceptable IMO.

Vlatombe avatar Jun 02 '22 09:06 Vlatombe

I'm not sure generating sources outside directories expected to contain something like that is expected. Since users will need to git add the file and commit it, there's no actual automation here.

I could see an argument for generating the index.jelly from POM description in the target/ though, OTOH a case could be made that developers are expected to provide a better description, e.g. (limited) HTML formatting is possible here.

daniel-beck avatar Jun 02 '22 09:06 daniel-beck

Sorry for maybe being unclear: the generated file is in target/classes, not in any source directory, see

twasyl avatar Jun 02 '22 09:06 twasyl

Sorry for maybe being unclear: the generated file is in target/classes, not in any source directory, see

Ah, I was confused by the path in the error message 🤦

daniel-beck avatar Jun 02 '22 10:06 daniel-beck

Sorry for maybe being unclear: the generated file is in target/classes, not in any source directory, see

I got confused as well. Looks okay to me. CI still needs fixing.

Vlatombe avatar Jun 02 '22 10:06 Vlatombe

I don't understand the current tests failures as in the output, there is the message which is checked in the logs 🤷

twasyl avatar Jun 02 '22 14:06 twasyl

Closing as stale. Nobody approved it in a year.

twasyl avatar Jun 06 '23 07:06 twasyl