Reputation: 294
I have a Spring Project and I want to add it (as dependency) to a Spring boot project. Is it possible?
I don't really know if I say something of really impossible (I don't know spring boot).
Upvotes: 2
Views: 879
Reputation: 16589
Yes, you can do it.
Change <packaging>
from war
to jar
in pom.xml of the spring project.
<packaging>jar</packaging>
Do a Maven clean and Maven install - Command : mvn clean install
to produce a jar
file of the spring project.
Create local repository of the jar to be held in the .m2
folder.
Command to create it- mvn install:install-file -Dfile=<<path>><<name of the jar>>.jar -DgroupId=<<base package name>> -DartifactId=<<name of the jar>> -Dversion=<<version number>> -Dpackaging=jar
Now, add the dependency in the pom.xml of the spring-boot project.
`<dependency>
<groupId><<base package name>></groupId>
<artifactId><<name of the jar>></artifactId>
<version><<version number>></version>
</dependency>`
That's it.
Note : Download the maven and set it to the path variable of the system.
Upvotes: 3