FELIX-561: Use same level of Bnd in script generated by bundle:ant as in the bundleplugin itself

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@656932 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AntPlugin.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AntPlugin.java
index fb06511..5aa871e 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AntPlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/AntPlugin.java
@@ -78,6 +78,7 @@
 
             // modify build template
             String buildXml = IOUtil.toString( getClass().getResourceAsStream( BUILD_XML ) );
+            buildXml = StringUtils.replace( buildXml, "BND_VERSION", builder.getVersion() );
             buildXml = StringUtils.replace( buildXml, "ARTIFACT_ID", artifactId );
 
             FileUtils.fileWrite( baseDir + BUILD_XML, buildXml );
diff --git a/bundleplugin/src/main/resources/build.xml b/bundleplugin/src/main/resources/build.xml
index 5cee4f1..a400ce2 100644
--- a/bundleplugin/src/main/resources/build.xml
+++ b/bundleplugin/src/main/resources/build.xml
@@ -20,7 +20,7 @@
     <echo message="Please run: $ant -projecthelp"/>
   </target>
 
-  <property name="bnd.version" value="0.0.238"/>
+  <property name="bnd.version" value="BND_VERSION"/>
 
   <target name="get-bnd"
           depends="test-offline"
@@ -34,13 +34,12 @@
          ignoreerrors="true"/>
   </target>
 
-  <taskdef resource="aQute/bnd/ant/taskdef.properties">
-    <classpath>
-      <pathelement location="${maven.repo.local}/biz/aQute/bnd/${bnd.version}/bnd-${bnd.version}.jar"/>
-    </classpath>
-  </taskdef>
-
   <target name="package" depends="compile,test,get-bnd" description="Package the bundle">
+    <taskdef resource="aQute/bnd/ant/taskdef.properties">
+      <classpath>
+        <pathelement location="${maven.repo.local}/biz/aQute/bnd/${bnd.version}/bnd-${bnd.version}.jar"/>
+      </classpath>
+    </taskdef>
     <pathconvert property="bnd.classpath" refid="build.classpath" pathsep=","/>
     <bnd files="maven-build.bnd" classpath="${maven.build.outputDir},${bnd.classpath}"/>
   </target>