佳佳的博客
Menu
首页
【Java】IntelliJ IDEA项目部署
Posted by
佳佳
on 2017-06-12
IT
IntelliJ IDEA
### Maven项目的部署 1. `pom.xml`文件中配置插件`maven-jar-plugin`和`maven-dependency-plugin` ```xml <?xml version="1.0" encoding="UTF-8"?> <project 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/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> ... </parent> <artifactId>xxx</artifactId> <packaging>jar</packaging> <properties> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties> <dependencies> ... </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.3.2</version> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> <classpathPrefix>lib/</classpathPrefix> <mainClass>com.xxx.xxx.Application</mainClass> </manifest> </archive> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.8</version> <configuration> <outputDirectory>${project.build.directory}/lib</outputDirectory> <excludeTransitive>false</excludeTransitive> <stripVersion>false</stripVersion> </configuration> <executions> <execution> <id>copy-dependencies</id> <phase>prepare-package</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/lib</outputDirectory> <overWriteReleases>false</overWriteReleases> <overWriteSnapshots>false</overWriteSnapshots> <overWriteIfNewer>true</overWriteIfNewer> <includeScope>compile</includeScope> </configuration> </execution> </executions> </plugin> </plugins> </build> </project> ``` 2. 使用Maven Projects窗口的Lifecycle,生成jar包 3. 使用Maven Projects窗口的Plugins => dependency => dependency:copy-dependencies, 导出所有依赖的包 ### 参考 --- > [IntelliJ IDEA WEB项目的部署配置](https://my.oschina.net/lujianing/blog/186737) --- > [在Intellij IDEA中使用Ant](http://ju.outofmemory.cn/entry/19239) --- > [IntelliJ IDEA 将 Maven 构建的 Java 项目打包](http://www.cnblogs.com/xuesong/p/3644597.html) ---
版权声明:原创文章,未经允许不得转载。
https://www.liujiajia.me/2017/6/12/【java】intellij-idea项目部署
“Buy me a nongfu spring”
« 【Java】ThreadLocal
【Vue-Router 2】帮助文档 »
昵称
*
电子邮箱
*
回复内容
*
(回复审核后才会显示)
提交
目录
AUTHOR
刘佳佳
江苏 - 苏州
软件工程师