Use spring boot dependency in another spring boot application

I am implementing 2 spring boot applications demo1 and demo2.
In the demo1 application, I have which is a spring bean class.
I want to re-use this class in the demo2 project. Using maven I can do this properly.
While exploring I found a few references like

  1. bootJar {
    classifier = ‘boot’
  2. compile group: ‘org.ask’, name: ‘demo1’, version: ‘0.0.1-SNAPSHOT’
    but saying not found this group and artifact.

Please do the needful on how to achieve this.

Thanks in advance.