I have a main Spring MVC Project and I created a SpringBoot .jar which contains the main class, a .pom file, and a class with a @Scheduler method. I need to add the SpringBoot .jar as a dependency in my main project. I have tried lots of things, but don't see any progress.
My first question is if the 2 projects need to be under the same folder. And if it matters that each project has its own repo.
My second question is if I injected it properly, what I must do so the @Scheduler to run? Does it start automatically like when I run the .jar standalone, or I need to do something? I mean when I run my main project, the main() method on my SpringBoot .jar also starts?
If yes, then I haven't imported the dependency as my project needs to. So far I tried to add it as a Profile, as a module, I added its repo on my main project .pom and as a dependency.
My Project POM:
<dependency>
<groupId>com.example</groupId>
<artifactId>matomo-data-parser</artifactId>
<version>0.0.1-SNAPSHOT</version>
<classifier>exec</classifier>
<scope>system</scope>
<systemPath>${basedir}/matomo-data-parser-0.0.1-SNAPSHOT.jar</systemPath>
</dependency>
I tried without scope and systemPath, cause when I enable those, a warning is triggered about the path. Also, most guides I read don't include them.
My .jar dependency POM:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>exec</classifier>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
I've done what's necessary with fat vs thin .jars so I can pass it as a dependency.
Any ideas would help me.
Thanks in advance!