[FELIX-6494] add version to Created-By entry
diff --git a/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java b/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
index 3a8117f..b3575f7 100644
--- a/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
+++ b/tools/maven-bundle-plugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
@@ -1139,7 +1139,8 @@
}
Attributes mainMavenAttributes = mavenManifest.getMainAttributes();
- mainMavenAttributes.putValue( "Created-By", "Apache Maven Bundle Plugin" );
+ mainMavenAttributes.putValue( "Created-By", createdBy( "Apache Maven Bundle Plugin", "org.apache.felix",
+ "maven-bundle-plugin" ) );
String[] removeHeaders = builder.getProperty( Constants.REMOVEHEADERS, "" ).split( "," );
@@ -1215,6 +1216,31 @@
builder.setJar( jar );
}
+ private static String getCreatedByVersion( String groupId, String artifactId )
+ {
+ try
+ {
+ final Properties properties = PropertyUtils.loadProperties( MavenArchiver.class.getResourceAsStream(
+ "/META-INF/maven/" + groupId + "/" + artifactId + "/pom.properties" ) );
+
+ return properties.getProperty( "version" );
+ }
+ catch ( IOException ioe )
+ {
+ return null;
+ }
+ }
+
+ private String createdBy( String description, String groupId, String artifactId )
+ {
+ String createdBy = description;
+ String version = getCreatedByVersion( groupId, artifactId );
+ if ( version != null )
+ {
+ createdBy += " " + version;
+ }
+ return createdBy;
+ }
protected static void mergeManifest( Instructions instructions, Manifest... manifests ) throws IOException
{