FELIX-3788 : [SCR MAVEN] specVersion incorrectly determined, depends on class order
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1414634 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java
index e1bf594..17e3823 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/SCRDescriptorGenerator.java
@@ -166,12 +166,17 @@
if ( specVersion == null ) {
specVersion = container.getComponentDescription().getSpecVersion();
logger.debug("Setting used spec version to " + specVersion);
- } else if (container.getComponentDescription().getSpecVersion().ordinal() > specVersion.ordinal() && this.options.getSpecVersion() != null) {
- // if a spec version has been configured and a component requires a higher
- // version, this is considered an error!
- iLog.addError("Component " + container + " requires spec version " + container.getComponentDescription().getSpecVersion().name()
- + " but plugin is configured to use version " + this.options.getSpecVersion(),
- desc.getSource());
+ } else if (container.getComponentDescription().getSpecVersion().ordinal() > specVersion.ordinal() ) {
+ if ( this.options.getSpecVersion() != null) {
+ // if a spec version has been configured and a component requires a higher
+ // version, this is considered an error!
+ iLog.addError("Component " + container + " requires spec version " + container.getComponentDescription().getSpecVersion().name()
+ + " but plugin is configured to use version " + this.options.getSpecVersion(),
+ desc.getSource());
+ } else {
+ specVersion = container.getComponentDescription().getSpecVersion();
+ logger.debug("Setting used spec version to " + specVersion);
+ }
}
}
processedContainers.add(container);