jar包转换pom依赖文件 maven项目

这篇博客介绍了如何将jar包转换为Maven项目的pom依赖,包括所需源码、pom依赖的详细步骤,并展示了转换效果。作者提供了jar包的位置信息和生成pom依赖的控制台输出。文章末尾分享了查找jar包和pom依赖的实用网站链接。
摘要由CSDN通过智能技术生成

所需的源码

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");
        //jar包路径
        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
评论 16
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

蜡笔小心_

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值