0

Is it possible to make a custom maven plugin out of a springboot application? I have a springboot service that I would like to autowire into my maven plugin Mojo class?

My maven plugin is a separate project and I have added the springboot project as a dependency.

I am unsure of the correct way to go about this?

Thank you.

  • Are you familiar with writing mojos? – Thorbjørn Ravn Andersen Nov 22 '19 at 09:26
  • I am new to writing mojos. Just unclear how I would inject a spring boot service into my mojo? – Kelvin piroddi Nov 22 '19 at 09:50
  • Can you explain why you would like to make a Spring Boot app into a Maven Plugin? Please explain the use case? – khmarbaise Nov 22 '19 at 12:18
  • I am trying to turn a open source project (https://github.com/zalando/zally) which is a openApi Linter into a Maven plugin. Essentially the plugin would take in the swagger yaml file and run the linter. – Kelvin piroddi Nov 22 '19 at 12:43
  • 1
    I have my doubts that this a good idea to make it a maven-plugin cause a you need to have correct bindings for the life cylce (starting the service) and sometime later ending the service (Spring Boot App) apart from the runtime it takes. I would see that more in a CI/CD integration but not in a build tool ?..Maybe I'm wrong... – khmarbaise Nov 22 '19 at 12:51
  • @Kelvinpiroddi Because mojos are inside Maven plugins and understanding how they work will allow you to determine if this is a good idea or not. I would suggest instead looking into the project beneath the spring boot code and invoke the library yourself in the plugin. – Thorbjørn Ravn Andersen Nov 22 '19 at 17:15

0 Answers0