https://github.com/dadrus/javahome-resolver-maven-plugin
Performs the lookup of the path to the used jdk and exports it as maven property
https://github.com/dadrus/javahome-resolver-maven-plugin
Last synced: over 1 year ago
JSON representation
Performs the lookup of the path to the used jdk and exports it as maven property
- Host: GitHub
- URL: https://github.com/dadrus/javahome-resolver-maven-plugin
- Owner: dadrus
- Created: 2015-07-01T08:51:55.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2017-08-16T06:55:54.000Z (almost 9 years ago)
- Last Synced: 2025-03-16T21:35:28.781Z (over 1 year ago)
- Language: Java
- Size: 4.88 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# javahome-resolver-maven-plugin
**Performs the lookup of the path to the used jdk and exports it as maven property**
If you have a need to develop and maintain a system and your maintenance and development branches diverge in used JDK, you could use [Maven Toolchains Plugin](https://maven.apache.org/plugins/maven-toolchains-plugin/).
But what if some of your tests require the path to the JDK used to build the system, e.g. to start an application server which can't be started with a newer
JDK, then this plugin may be for you.
In my specific case I use [arquillian](http://arquillian.org) with JBoss. The corresponding arquillian container [configuration](https://docs.jboss.org/author/display/ARQ/JBoss+AS+7.1,+JBoss+EAP+6.0+-+Managed)
expects an optional `javaHome` variable provided, otherwise a system wide `JAVA_HOME` is used. Given the situation, that the development main stream uses java
8 and JBoss EAP 6.4, but the maintenance must be performed using java 7 and JBoss EAP 6.0 (which does not support java 8), I was looking for a way not to be
forced to switch between environment configurations if I just switch a branch. The idea was to use the aforementioned maven toolchains plugin. Unfortunately
neither the toolchains plugin, nor the surefire, failsafe, or other toolchains aware plugins, I'm familiar with, do expose a variable pointing to a path for the
choosen JDK. Thus this plugin was born.
## Plugin Behaviour
- exports a `javaHome` property with the path to choosen JDK if maven toolchains plugin is used, otherwise
- exports a `javaHome` property which has the same value as the configured `JAVA_HOME` environment variable.
## Limitations
The plugin does not integrate with eclipse properly. I was unable to find out how to force eclipse to refilter affected ressources.
## Usage
You should add "javahome-resolver-maven-plugin" to your `` configuration. The default lifecycle phase is `validate`. The plugin has a single goal - `resolve`.
Here is an example:
```xml
org.apache.maven.plugins
maven-toolchains-plugin
validate
toolchain
${maven.compiler.target}
eu.drus.maven.plugins
javahome-resolver-maven-plugin
resolve
```