- String groupId = System.getProperty(KARAF_DISTRO_GROUPID_PROP,KARAF_DISTRO_GROUPID);
- String artifactId = System.getProperty(KARAF_DISTRO_ARTIFACTID_PROP,KARAF_DISTRO_ARTIFACTID);
- String version = System.getProperty(KARAF_DISTRO_VERSION_PROP,KARAF_DISTRO_VERSION);
- String type = System.getProperty(KARAF_DISTRO_TYPE_PROP,KARAF_DISTRO_TYPE);
- MavenArtifactUrlReference karafUrl = maven()
- .groupId(groupId)
- .artifactId(artifactId)
- .version(version)
+ String groupId = System.getProperty(KARAF_DISTRO_GROUPID_PROP, KARAF_DISTRO_GROUPID);
+ String artifactId = System.getProperty(KARAF_DISTRO_ARTIFACTID_PROP, KARAF_DISTRO_ARTIFACTID);
+ String version = System.getProperty(KARAF_DISTRO_VERSION_PROP);
+ String type = System.getProperty(KARAF_DISTRO_TYPE_PROP, KARAF_DISTRO_TYPE);
+ if (version == null) {
+ // We use a properties file to retrieve ${karaf.version}, instead of
+ // .versionAsInProject()
+ // This avoids forcing all users to depend on Karaf in their POMs
+ Properties abstractConfigTestBaseProps = new Properties();
+ try (InputStream abstractConfigTestBaseInputStream = Thread.currentThread().getContextClassLoader()
+ .getResourceAsStream(PROPERTIES_FILENAME)) {
+ abstractConfigTestBaseProps.load(abstractConfigTestBaseInputStream);
+ } catch (final IOException e) {
+ LOG.error("Unable to load {} to determine the Karaf version", PROPERTIES_FILENAME, e);
+ }
+ version = abstractConfigTestBaseProps.getProperty(KARAF_DISTRO_VERSION_PROP);
+ }
+ MavenArtifactUrlReference karafUrl = maven().groupId(groupId).artifactId(artifactId).version(version)