I'm working on a project where I have a "core" and an "API" that are two separate maven projects.
Currently, I'm exporting the API in a jar using Eclipse and I'm linking it in maven like that :
<dependency>
<groupId>com.project.my</groupId>
<artifactId>project-api</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/src/main/resources/dependencies/project-api.jar</systemPath>
</dependency>
It's working properly and I can use the classes defined in my API.
But now I want to have a better workflow and I'm trying to install the API in my local maven repository and then link it normaly in the core :
<dependency>
<groupId>com.project.my</groupId>
<artifactId>project-api</artifactId>
<version>1.0.0</version>
</dependency>
But when I run maven clean install I'm getting the following error :
Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.3.3.RELEASE:repackage failed: Unable to find main class
And I indeed don't have a main in my API, since I don't need one.
Note that I use spring-boot for both projects, as I'm using some of their dependencies and it's easier to let them manage the versions (I only use the utility classes in the API).
So I'd like to know if I HAVE to have a main anyway, even if I don't ever use it, or if I'm doing something wrong trying to install my API in the local repository ?
Thanks :)
Thanks to Thilo's wise advices, I managed to get it working.
So what I did was removing all unused spring-boot references from my API project and only keeping the spring dependencies I needed, and I was then able to run mvn clean install properly.
Here's what I got rid of :
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
and
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.3.RELEASE</version>
<relativePath/>
</parent>
I had to add the versions to some of the dependencies that were previously managed by spring-boot, but it's now working fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With