fastjson的maven的pom_根据已有项目jar文件生成maven的pom.xml

这个Java程序演示了如何从已有的JAR文件中读取元数据,并生成对应的Maven pom.xml文件。它解析JAR的MANIFEST.MF获取Bundle-Name和Bundle-Version,然后使用Jsoup查询Maven中央仓库获取依赖信息。
摘要由CSDN通过智能技术生成

package demo;

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("/Users/xxx/Documents/work/workspaces/maven_demo/src/resources/webapp/WEB-INF/lib");

for (File jar : dir.listFiles()) {

JarInputStream jis = new JarInputStream(new FileInputStream(jar));

Manifest mainmanifest = jis.getManifest();

jis.cl

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
com.alibaba.fastjsonpom.xml文件如下所示: ```xml <project> <modelVersion>4.0.0</modelVersion> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.78</version> <packaging>jar</packaging> <name>fastjson</name> <description>Fast JSON Processor</description> <url>https://github.com/alibaba/fastjson</url> <licenses> <license> <name>The Apache Software License, Version 2.0</name> <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> <distribution>repo</distribution> </license> </licenses> <developers> <developer> <name>Wu Yongzheng</name> <email>wuyongzheng@alibaba-inc.com</email> <organization>Alibaba Group</organization> <organizationUrl>https://www.alibaba.com/</organizationUrl> <roles> <role>Developer</role> </roles> </developer> </developers> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.1</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> </plugins> </build> </project> ``` 这是一份Maven项目的配置文件,描述了该项目的基本信息、依赖关系、构建配置等信息。其中,groupId、artifactId、version等元素是Maven项目的基本信息;dependencies元素描述了该项目所依赖的其他库;build元素描述了该项目的构建配置,包括编译器版本、插件等。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值