码迷,mamicode.com
首页 > 编程语言 > 详细

maven 项目linux运行可执行jar

时间:2020-12-07 12:25:17      阅读:6      评论:0      收藏:0      [点我收藏+]

标签:files   sse   oal   process   assembly   rgb   ESS   plugin   apach   

  • 可运行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

标签:files   sse   oal   process   assembly   rgb   ESS   plugin   apach   

原文地址:https://www.cnblogs.com/luweiweicode/p/14072851.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!