diff --git a/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractJenkinsManifestMojo.java b/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractJenkinsManifestMojo.java index 19677e1001..1c65643588 100644 --- a/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractJenkinsManifestMojo.java +++ b/src/main/java/org/jenkinsci/maven/plugins/hpi/AbstractJenkinsManifestMojo.java @@ -19,6 +19,8 @@ import org.apache.maven.archiver.MavenArchiver; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.DependencyResolutionRequiredException; +import org.apache.maven.artifact.versioning.ArtifactVersion; +import org.apache.maven.artifact.versioning.OverConstrainedVersionException; import org.apache.maven.model.Developer; import org.apache.maven.model.License; import org.apache.maven.model.Scm; @@ -109,6 +111,34 @@ protected void setAttributes(Manifest.ExistingSection mainSection) throws MojoEx mainSection.addAttributeAndCheck(new Manifest.Attribute("Plugin-Class",pluginClassName)); } + + mainSection.addAttributeAndCheck( + new Manifest.Attribute("Extension-Name", project.getArtifactId())); + mainSection.addAttributeAndCheck( + new Manifest.Attribute("Implementation-Title", project.getArtifactId())); + mainSection.addAttributeAndCheck( + new Manifest.Attribute("Implementation-Version", project.getVersion())); + if (project.getOrganization() != null) { + mainSection.addAttributeAndCheck( + new Manifest.Attribute("Implementation-Vendor", project.getOrganization().getName())); + } + mainSection.addAttributeAndCheck( + new Manifest.Attribute("Specification-Title", project.getDescription())); + try { + ArtifactVersion version = project.getArtifact().getSelectedVersion(); + String specVersion = + String.format("%s.%s", version.getMajorVersion(), version.getMinorVersion()); + mainSection.addAttributeAndCheck( + new Manifest.Attribute("Specification-Version", specVersion)); + } catch (OverConstrainedVersionException e) { + throw new ManifestException( + "Failed to get selected artifact version to calculate the specification version: " + e.getMessage()); + } + if (project.getOrganization() != null) { + mainSection.addAttributeAndCheck( + new Manifest.Attribute("Specification-Vendor", project.getOrganization().getName())); + } + mainSection.addAttributeAndCheck(new Manifest.Attribute("Group-Id",project.getGroupId())); mainSection.addAttributeAndCheck(new Manifest.Attribute("Short-Name",project.getArtifactId())); mainSection.addAttributeAndCheck(new Manifest.Attribute("Long-Name",pluginName));