关于Maven的 install 和 打包(maven install |
您所在的位置:网站首页 › maven打包war失败 › 关于Maven的 install 和 打包(maven install |
本篇文章为你整理了关于Maven的 install 和 打包(maven install-file)的详细内容,包含有maven install war包 maven install-file maven install deploy maven installation 关于Maven的 install 和 打包,希望能帮助你了解 关于Maven的 install 和 打包。 进入pom.xml文件目录下,使用命令mvn install 当然也可以使用类似idea这类本身已经集成好maven插件按钮的编辑器进行安装 安装过程会输出安装jar包的目录信息,同样的,跟class编译后的目标文件一起,放在target目录下 注意:开发编译过程中,如果只 编译 mvn compile,修改的代码是不会生效的,必须重新执行install生成新的包。再执行jetty run(Windows下使用jetty作为服务器)过程自然会解析jar包 [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ thomson-content-rpc-api ---
[INFO] Building jar: E:\JavaDevelop\thomson-content\thomson-content-rpc-api\target\thomson-content-rpc-api.jar
在maven里面,install是安装的意思,也就是说将代码安装到本地仓库中,成为可运行的包。 通常一个成熟的项目,所依赖的外部类比较多,因此在第一次install代码的时候,会花费较长的时间。例如某个项目,我的本地仓库就达到了1.2G。
如何创建自己的本地仓库? 修改maven安装目录下的/conf/settings.xml文件 settings xmlns="http://maven.apache.org/SETTINGS/1.2.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.2.0 http://maven.apache.org/xsd/settings-1.2.0.xsd" !-- localRepository The path to the local repository maven will use to store artifacts. Default: ${user.home}/.m2/repository localRepository E:/MavenRepository /localRepository
修改完后,执行 mvn help:system,会自动下载基础的工程到本地仓库
通常情况下,类似idea编辑器会把仓库设定在c盘,我们可以自行修改自己想要存放的目录 File - Settings,勾选以下选项框即可修改目录。 再执行mvn命令时,新生成class文件和jar包会放置在本地仓库中
关于打包 很方便,可以根据需要设置权限(按Linux的权限定义),最终生成的压缩包会放在target目录下 pom.xml中添加插件,指定assembly.xml文件 plugin
artifactId maven-assembly-plugin /artifactId configuration descriptor src/main/assembly/assembly.xml /descriptor /configuration executions execution id make-assembly /id phase package /phase goals goal single /goal /goals /execution /executions /plugin
配置包后缀和设置权限 需要在src目录下创建assembly目录,目录下创建assemly.xml文件,和bin目录来放置一些执行脚本 assembly.xml assembly
id assembly /id formats !-- 生成包后缀名 -- format tar.gz /format /formats includeBaseDirectory true /includeBaseDirectory fileSets fileSet directory src/main/assembly/bin /directory outputDirectory bin /outputDirectory !-- 设置linux权限 -- fileMode 0755 /fileMode /fileSet fileSet directory src/main/assembly/conf /directory outputDirectory conf /outputDirectory fileMode 0644 /fileMode /fileSet /fileSets dependencySets dependencySet outputDirectory lib /outputDirectory scope runtime /scope /dependencySet /dependencySets /assembly
以上就是关于Maven的 install 和 打包(maven install-file)的详细内容,想要了解更多 关于Maven的 install 和 打包的内容,请持续关注盛行IT软件开发工作室。 郑重声明:本文由网友发布,不代表盛行IT的观点,版权归原作者所有,仅为传播更多信息之目的,如有侵权请联系QQ332078507,我们将第一时间修改或删除,多谢。 |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |