maven 几个插件的使用
1. compile
1 2 3 4 5 6 7 8 9 10 11 | <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> <encoding>UTF-8</encoding> <compilerArguments> <extdirs>lib/</extdirs> // 三方jar 包编译配置 </compilerArguments> </configuration> </plugin> |
2. 依赖打包
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <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> <overWriteReleases> false </overWriteReleases> <overWriteSnapshots> false </overWriteSnapshots> <overWriteIfNewer> true </overWriteIfNewer> </configuration> </execution> </executions> </plugin> |
3. 可执行jar 包
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <build> <finalName>image</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.4</version> <configuration> <archive> <manifest> <addClasspath> true </addClasspath> <classpathPrefix>lib/</classpathPrefix> <mainClass>image_handle.App</mainClass> </manifest> </archive> </configuration> </plugin> </plugins> </build> |
4. 另一个包含依赖
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <archive> <manifest> <mainClass>com.allen.capturewebdata.Main</mainClass> </manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> </configuration> </plugin> </plugins> |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
2014-10-13 BNF 和 ABNF 扩充巴科斯范式 了解