当前java工程通用工具:
1、开发工具IDE:Eclipse
2、项目管理工具:Maven
1、开发工具IDE:Eclipse
2、项目管理工具:Maven
代码开发完毕,如何打成jar包?如何打成整个运行的包?
1、如何打成jar包?
1))创建maven工程后,执行 maven install即可自动生成jar包;
2)pom.xml中增加如下配置,可以打包源码包;
<build> <plugins> <plugin> <artifactId>maven-source-plugin</artifactId> <version>2.1</version> <executions> <execution> <phase>compile</phase> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
2、如何打成运行包?
1)pom.xml中增加如下配置,可以打包运行包;<build > <resources > <resource > <directory >src/main/resources</ directory> <targetPath >${project.build.directory}/ conf</ targetPath> </resource > </resources > <plugins > <plugin > <artifactId >maven-jar-plugin</artifactId > <configuration > <archive > <manifest > <addClasspath >true </addClasspath > <classpathPrefix >lib </classpathPrefix > <mainClass >${maven.main.class} </mainClass > </manifest > <manifestEntries > <Class-Path >conf/ </Class-Path > </manifestEntries > </archive > <excludes > <exclude >src/main/resources/** </exclude > </excludes > </configuration > </plugin > <plugin > <artifactId >maven-assembly-plugin</artifactId > <version >2.4 </version > <executions > <execution > <id >make-tar.gz </id > <phase >package </phase > <goals > <goal >single </goal > </goals > <configuration > <finalName >${maven.gz.name} </finalName > <skipAssembly >false </skipAssembly > <descriptors > <descriptor >tar.gz.xml </descriptor > </descriptors > </configuration > </execution > </executions > </plugin > </plugins > </build >
2)tar.gz.xml文件:<?xml version="1.0" encoding= "UTF-8"?> <assembly xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/assembly-1.0.0.xsd" > <id >package </id > <formats > <format >tar.gz </format > </formats > <includeBaseDirectory >false </includeBaseDirectory > <fileSets > <fileSet > <directory >bin </directory > <outputDirectory >/ </outputDirectory > <fileMode >0755 </fileMode > //说明:设置bin目录下文件的操作权限 -rwxr-xr-x 1 root root 340 Jan 9 10:22 video-itenv.sh <directoryMode >0755 </directoryMode > </fileSet > <fileSet > <directory >${project.build.directory}/ conf</ directory> <outputDirectory >/ conf</ outputDirectory> </fileSet > </fileSets > <files > <file > <source >${project.build.directory}/${project.build.finalName}.jar </source > <destName >/${project.build.finalName}.jar </destName > </file > </files > <dependencySets > <dependencySet > <outputDirectory >lib</outputDirectory> <scope >runtime </scope > </dependencySet > </dependencySets > </assembly>
相关推荐
Java_apache-maven-3.3.1.rar_安装包_kaic Java_apache-maven-3.3.1.rar_安装包_kaic Java_apache-maven-3.3.1.rar_安装包_kaic Java_apache-maven-3.3.1.rar_安装包_kaic Java_apache-maven-3.3.1.rar_安装包_kaic ...
zookeeper云的学习笔记-云的学习笔记系统-云的学习笔记系统源码-云的学习笔记管理系统-云的学习笔记管理系统java代码-云的学习笔记系统设计与实现-基于ssm的云的学习笔记系统-基于Web的云的学习笔记系统设计与实现-...
云的学习笔记-云的学习笔记系统-云的学习笔记系统源码-云的学习笔记管理系统-云的学习笔记管理系统java代码-云的学习笔记系统设计与实现-基于ssm的云的学习笔记系统-基于Web的云的学习笔记系统设计与实现-云的学习...
apache-maven-3.8.8.zip压缩包内容: apache-maven-3.8.8-bin.tar.gz apache-maven-3.8.8-bin.zip apache-maven-3.8.8-src.tar.gz apache-maven-3.8.8-src.zip
maven-java-formatter-plugin-0.4.jar
maven资源 apache-maven-3.3.9-bin.zip
apache-maven-3.9.6-bin
apache-maven-3.8.4-bin.zip
apache-maven-3.6.1-bin
apache-maven-3.0.5 apache-maven-3.1.1 apache-maven-3.2.5 apache-maven-3.3.9 apache-maven-3.5.4 apache-maven-3.6.3 apache-maven-3.8.5 每个版本包含4个文件: apache-maven-3.8.5-bin.tar.gz apache-maven-...
maven-java-formatter-plugin-0.4-sources.jar
apache-maven-3.9.4.zip压缩包内容: apache-maven-3.9.4-bin.tar.gz apache-maven-3.9.4-bin.zip apache-maven-3.9.4-src.tar.gz apache-maven-3.9.4-src.zip