首页 > 编程语言 >java maven工程打出可执行jar包

java maven工程打出可执行jar包

时间:2022-12-15 17:55:30浏览次数:53  
标签:java jar maven plugins apache org

java maven工程打出可执行jar包,在pom.xml中添加如下配置即可
<build>
<plugins>
<!-- 设置编译版本 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>

<!--可运行jar包-->
<!--maven-jar-plugin的作用是配置mainClass和指定classpath。-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<!--是否在manifest文件中添加classpath。默认为false。-->
<addClasspath>true</addClasspath>
<!--指定类路径前缀,也就是依赖的jar包所在的文件夹-->
<classpathPrefix>lib/</classpathPrefix>
<!--指定启动类-->
<mainClass>com.cln2ymb.Cln2ymb</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/lib
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>

</plugins>
</build>

标签:java,jar,maven,plugins,apache,org
From: https://www.cnblogs.com/loveUworld/p/16985719.html

相关文章

  • Java-快速入门、IDEA开发工具的使用1-笔记
    1.Java的概述Java是sun公司1995推出的,2009年被oracle收购Java的爸爸:詹姆斯.高斯林Java是一门高级编程语言:语言风格接近人类的自然语言,写程序简单易懂Java的流行度很高,商业占......
  • Java:SpringBoot使用EasyExcel实现Excel文件的导出下载和上传导入功能
    SpringBoot使用EasyExcel实现Excel文件的导出下载和上传导入功能文件目录$tree-Itarget.├──README.md├──pom.xml└──src└──main├─......
  • maven安装与配置
    maven安装与配置下载mavenhttps://maven.apache.org配置环境变量我的电脑/此电脑-》属性-》高级系统设置-》环境变量-》系统-》系统变量-》新建......
  • Java进阶——线程基础
    线程基础1、线程介绍1.1、线程相关概念程序(program):是完成特定任务,用某种语言编写的一组的集合(例如:java代码就是一个程序)进程:是指运行中的程序(比如:我现在使用的Typora)......
  • Java进阶——IO流
    IO流一、文件1.1、文件流文件在程序中是以流的形式来操作的流:数据在数据源(文件)和程序(内存)之间经历的路径输入流:数据从数据源(文件)到程序(内存)的路径输入流:数据从程序(内存)到数......
  • JavaconfigApplicationTests
    packagecom.example.demo;importcom.example.demo.config.JavaConfig;importcom.example.demo.model.Printer;importorg.junit.Test;importorg.junit.runner.Ru......
  • java DefaultMutableTreeNode 树形结构
    目录1.Tree的概念11.1.treeNode接口,mutabletreenode接口11.2.10-4:以TreeModel构造JTree.12.功能要求22.1.树形结构节点的查找与定位23.节点......
  • java+Selenium(一)八种元素获取方式
    官方文档:https://www.selenium.dev/documentationchromedriver下载地址:注意:需要下载与浏览器匹配版本的http://chromedriver.storage.googleapis.com/index.htmlhttp://......
  • Java数组(3)三种初始化及内存分析
           ......
  • java idea spring mvc 入门 最起码 我8080跑起来了
    IDEA建立SpringMVCHelloWorld详细入门教程---------------------------------------------生活的意义并不是与他人争高下,而在于享受努力实现目标的过程,结果是对自......