Reputation: 1076
I have problems building a Maven multi module project. I have a custom JRE which is added as System Libary on parent level. When I try to build child modules, they are not finding jars from custom JRE. Should I somehow add this custom JRE to parent module's POM as dependency or what would be the right way to configure this?
Upvotes: 0
Views: 433
Reputation: 328594
JRE and Maven dependencies are two different things, make sure you don't mix them up. Maven can't change the JRE because at the time when the first byte code of Maven is executed, the JRE is already active (it's what is executing Maven).
Now to solve your problem.
On the command line, use the environment variable JAVA_HOME
to tell Maven which Java runtime to use.
In Eclipse, when you start Maven with one of the menu entries, you have to use "Run -> Run as -> Maven build...". The second tab in the dialog reads "JRE". Here, you can select the JRE to use.
If you have existing entries, you can edit them in the "Launch Configuration" dialog (last entry in the Run/Debug menus and popups).
Lastly, make sure you give Maven a full SDK; a pure JRE is not enough if you need to compile Java code. The Java compiler is in lib/tools.jar
in a normal SDK.
Upvotes: 1