所需的源码
package com.example.demo.test;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.jar.JarInputStream;
import java.util.jar.Manifest;
import org.dom4j.Element;
import org.dom4j.dom.DOMElement;
import org.jsoup.Jsoup;
import com.alibaba.fastjson.JSONObject;
public class MakePomFromJars {
public static void main(String[] args) throws FileNotFoundException, IOException {
Element dependencys = new DOMElement("dependencys");
File dir = new File("D:\\SSM-Demo6-3\\WebRoot\\WEB-INF\\lib");
for (File jar : dir.listFiles()) {
JarInputStream jis = new JarInputStream(new FileInputStream(jar));
Manifest mainmanifest = jis.getManifest();
jis.close();
if (mainmanifest == null) {
System.err.println(jar.getName());
continue;
}
String bundleName = mainmanifest.getMainAttributes().getValue("Bundle-Name");
String bundleVersion = mainmanifest.getMainAttributes().getValue("Bundle-Version");
Element ele = null;
System.out