Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Continue maven build although dependency is missing

Is there a way to tell maven to continue the build although a dependency ist missing? I tried <optional>true</optional> but this doesn't seem to do it in this scenario.

I have build a costum Maven Plugin for the package phase and it does still have to package even if one or multiple dependencies could not be found.

Thanks in advance.

like image 859
fr1zle Avatar asked Aug 28 '26 00:08

fr1zle


2 Answers

<optional>true</optional>

Optional means that a client using your library does not necessarily need that dependency. An example is Spring's ORM module, that has optional dependencies to Hibernate, JDO, JPA and mybatis. Nobody will ever use all of these in a project, so each is marked as optional.

Your case is completely different, you are trying to compile something, and you can only do that if the libraries you compile against are present. Sorry, it don't work like that.

like image 156
Sean Patrick Floyd Avatar answered Aug 30 '26 14:08

Sean Patrick Floyd


If you are trying to build something while the rest of the team finishes their parts, you could use a Mocking framework that creates something that looks like the classes you need . Check out, for example mockito

Otherwise, the only thing you can do is run mvn with -fn (fail-never) but that will mask all your errors and not just the missing dependencies

like image 22
Miquel Avatar answered Aug 30 '26 15:08

Miquel