use of org.jetbrains.idea.maven.importing.ManifestImporter in project intellij-community by JetBrains.
the class ManifestBuilder method getConfiguredManifest.
@NotNull
private static Manifest getConfiguredManifest(@NotNull MavenProject mavenProject, @Nullable Element manifestConfiguration, @NotNull Map<String, String> entries) throws ManifestException {
final Manifest manifest = new Manifest();
boolean isAddDefaultSpecificationEntries = Boolean.valueOf(MavenJDOMUtil.findChildValueByPath(manifestConfiguration, "addDefaultSpecificationEntries", "false"));
if (isAddDefaultSpecificationEntries) {
addManifestAttribute(manifest, entries, "Specification-Title", mavenProject.getName());
addManifestAttribute(manifest, entries, "Specification-Version", mavenProject.getMavenId().getVersion());
}
boolean isAddDefaultImplementationEntries = Boolean.valueOf(MavenJDOMUtil.findChildValueByPath(manifestConfiguration, "addDefaultImplementationEntries", "false"));
if (isAddDefaultImplementationEntries) {
addManifestAttribute(manifest, entries, "Implementation-Title", mavenProject.getName());
addManifestAttribute(manifest, entries, "Implementation-Version", mavenProject.getMavenId().getVersion());
addManifestAttribute(manifest, entries, "Implementation-Vendor-Id", mavenProject.getMavenId().getGroupId());
}
String packageName = MavenJDOMUtil.findChildValueByPath(manifestConfiguration, "packageName");
if (packageName != null) {
addManifestAttribute(manifest, entries, "Package", packageName);
}
String mainClass = MavenJDOMUtil.findChildValueByPath(manifestConfiguration, "mainClass");
if (!StringUtil.isEmpty(mainClass)) {
addManifestAttribute(manifest, entries, "Main-Class", mainClass);
}
boolean isAddClasspath = Boolean.valueOf(MavenJDOMUtil.findChildValueByPath(manifestConfiguration, "addClasspath", "false"));
if (isAddClasspath) {
final ManifestImporter manifestImporter = ManifestImporter.getManifestImporter(mavenProject.getPackaging());
String classpath = manifestImporter.getClasspath(mavenProject, manifestConfiguration);
if (!classpath.isEmpty()) {
addManifestAttribute(manifest, "Class-Path", classpath);
}
}
return manifest;
}
use of org.jetbrains.idea.maven.importing.ManifestImporter in project intellij-community by JetBrains.
the class ManifestBuilder method getClasspath.
@NotNull
public static String getClasspath(@NotNull MavenProject mavenProject) {
Element mavenPackagingPluginConfiguration = getMavenPackagingPluginConfiguration(mavenProject);
final Element mavenArchiveConfiguration = mavenPackagingPluginConfiguration != null ? mavenPackagingPluginConfiguration.getChild("archive") : null;
final Element manifestConfiguration = mavenArchiveConfiguration != null ? mavenArchiveConfiguration.getChild("manifest") : null;
final ManifestImporter manifestImporter = ManifestImporter.getManifestImporter(mavenProject.getPackaging());
return manifestImporter.getClasspath(mavenProject, manifestConfiguration);
}
Aggregations