FELIX-1439: add project organization name/url properties
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@810723 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
index 8d06c7a..c708d9c 100644
--- a/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
+++ b/bundleplugin/src/main/java/org/apache/felix/bundleplugin/BundlePlugin.java
@@ -867,10 +867,16 @@
if ( currentProject.getOrganization() != null )
{
- header( properties, Analyzer.BUNDLE_VENDOR, currentProject.getOrganization().getName() );
+ String organizationName = currentProject.getOrganization().getName();
+ header( properties, Analyzer.BUNDLE_VENDOR, organizationName );
+ properties.put( "project.organization.name", organizationName );
+ properties.put( "pom.organization.name", organizationName );
if ( currentProject.getOrganization().getUrl() != null )
{
- header( properties, Analyzer.BUNDLE_DOCURL, currentProject.getOrganization().getUrl() );
+ String organizationUrl = currentProject.getOrganization().getUrl();
+ header( properties, Analyzer.BUNDLE_DOCURL, organizationUrl );
+ properties.put( "project.organization.url", organizationUrl );
+ properties.put( "pom.organization.url", organizationUrl );
}
}
diff --git a/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java b/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
index 55e53f4..29496dc 100644
--- a/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
+++ b/bundleplugin/src/test/java/org/apache/felix/bundleplugin/BundlePluginTest.java
@@ -23,10 +23,12 @@
import java.io.File;
import java.util.Map;
import java.util.TreeMap;
+import java.util.Properties;
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
import org.apache.maven.project.MavenProject;
import org.apache.maven.shared.osgi.DefaultMaven2OsgiConverter;
+import org.apache.maven.model.Organization;
import aQute.lib.osgi.Analyzer;
import aQute.lib.osgi.Builder;
@@ -163,6 +165,30 @@
assertEquals( "", transformedInstructions.get( "-z" ) );
}
+ public void testDefaultPropertiesIncludeOrganization()
+ {
+ final Organization organization = new Organization();
+ organization.setName( "Example Organization" );
+ organization.setUrl( "http://example.org" );
+
+ // MavenProjectStub.setOrganization(Organization) doesn't do anything, so we have to make it work this way
+ MavenProject project = new MavenProjectStub()
+ {
+ @Override public Organization getOrganization()
+ {
+ return organization;
+ }
+ };
+ project.setGroupId( "group" );
+ project.setArtifactId( "artifact" );
+ project.setVersion( "1.1.0.0" );
+
+ Properties properties = plugin.getDefaultProperties( project );
+ assertEquals( organization.getName(), properties.getProperty( "project.organization.name" ) );
+ assertEquals( organization.getName(), properties.getProperty( "pom.organization.name" ) );
+ assertEquals( organization.getUrl(), properties.getProperty( "project.organization.url" ) );
+ assertEquals( organization.getUrl(), properties.getProperty( "pom.organization.url" ) );
+ }
public void testVersion() throws Exception
{