maven 项目linux运行可执行jar
Posted Bonnie_ξ
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了maven 项目linux运行可执行jar相关的知识,希望对你有一定的参考价值。
- 可运行jar 打包插件
<build> <finalName>project_name</finalName> <resources> <resource> <directory>src/main/resources</directory> <!-- 资源根目录排除各环境的配置,使用单独的资源目录来指定 --> <excludes> <exclude>dev/**</exclude> <exclude>test/**</exclude> <exclude>dev2/**</exclude> <exclude>pro/**</exclude> </excludes> </resource> <resource> <directory>src/main/resources/${profiles.active}</directory> </resource> </resources> <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> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> <!-- <useProjectArtifact>false</useProjectArtifact> --> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.3.2</version> <!-- <executions> <execution> <phase>package</phase> <goals> <goal>test-jar</goal> </goals> </execution> </executions> --> </plugin> </plugins> </build>
- linux 执行main 方法 不带参
nohup java -cp project-jar-with-dependencies.jar com.zxwa.ntmss.img2text.NtmssV3LicenceImgProcesser >licenceImg.log &
- linux 执行main 方法带参数..
nohup java -cp project-jar-with-dependencies.jar com.zxwa.ntmss.img2text.NtmssV3LicenceImgProcesser param1 param2 >licenceImg.log &
以上是关于maven 项目linux运行可执行jar的主要内容,如果未能解决你的问题,请参考以下文章
使用 `publishToMavenLocal` 构建可以发布到 maven 本地 repo 的可执行 jar - spring boot 项目