derlin / bitdowntoc

Online and command-line Markdown TOC generator, with built-in support for BitBucket Server, GitHub, Gitlab, dev.to and more!
https://bitdowntoc.derlin.ch
Other
87 stars 8 forks source link

Question: How to run bitdowntoc as a maven goal? #22

Closed davidkubecka-ext43694 closed 6 months ago

davidkubecka-ext43694 commented 12 months ago

I would like to run bitdowntoc as part of the build process so that the TOC generation is fully automatic. At the same time I would like to do version managent in a standard way, e.g. via maven?

Is this anyhow supported?

derlin commented 12 months ago

Hello there! Happy to know you find this project helpful and thanks for opening an issue.

Incorporating bitdowntoc to the build or the CI should be easy using the command line tool (i.e. the jar, see this section in the README). You can either use a pre-commit hook to run bitdowntoc before every commit, or a GitHub Action (or another CI). In the latter case, you could choose between automatically amending the commit, or just checking that the TOC is up-to-date and failing the build if not.

For the version control, I am not sure I understand your need. Version control should be implemented in your CI process (using e.g. release-please) and of course git. What would you expect a TOC generator to do for version management?

derlin commented 12 months ago

Rereading your question, you could use the maven exec plug-in to run bitdowntoc https://www.mojohaus.org/exec-maven-plugin/

You could also use it to download the jar (using eg curl) and save it to target.

davidkubecka-ext43694 commented 12 months ago

Downloading the jar is surely one option but it's not particulary nice. I was hoping for something more standard, i.e.

This way there would be a standard way how to manage the dependecy (instead of always downloading the jar) and how to run the tool itself (pre-commit hooks are fragile because users forget to install them).

So perhaps what I just ask for is to publish the jar on maven :-) Or if you have any other solution given the constraints above I would be happy to here that.

derlin commented 12 months ago

Publishing to maven would be the best, I agree. The process is however complicated and slow.

I propose to first publish it to the GitHub Maven registry, so you can play a bit with it? The only downside is that it will require you to provide a github PAT or username/password in your pom (see https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry#authenticating-to-github-packages).

davidkubecka-ext43694 commented 12 months ago

As a first step I'm more than ok with just GitHub Maven registry 👍 Depending on how it goes I would then ask for a Maven central publish. In the meantime both of us can think of other options (if there are any).

derlin commented 11 months ago

I published the packages (be sure to use the -jvm one for java, as this project is multiplatform). Can you try and confirm this is what you want? If so, I will go on and add the publishing to the CI pipeline.

derlin commented 10 months ago

@davidkubecka-ext43694 any news? Were you able to test it on your part?

derlin commented 7 months ago

@davidkubecka-ext43694 ping?

derlin commented 6 months ago

Closing due to inactivity.