I have a spring boot project Proj-Main
and another project which contains entity classes called Proj-Entities
. Both of these are present locally. I have added the latter as a dependency of the first. It works perfectly in my IDE (in my case STS) however when i try to create a jar to deploy to server using mvn package
or even mvn install
for Proj-Main
, it fails to find classes which are present inside Proj-Entities
. I have checked my .m2
directory and I am able to find the jar for Proj-Entities
there. I have tried standard clean and rebuild techniques but it just doesn't seem to work.
This is how i am adding dependency:
<dependency>
<groupId>com.proj</groupId>
<artifactId>Proj-Entities</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
My build task looks like this:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Solved this by adding the following build goals to the Proj-Entities
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>