使用idea中的maven打包jar包

注意点:

pom.xml中的内容

1.maven打包插件

2.文件中不能有“org.mybatis.generator”的插件

3.如果有引用本地的jar包,需要在pom文件中添加 引用本地jar包的代码

<build>
        <plugins>
            <!--maven打包使用-->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <!--自动生成pojo类、**Mapper、**Mapper.xml 插件-->
    <!--        <plugin>
                <groupId>org.mybatis.generator</groupId>
                <artifactId>mybatis-generator-maven-plugin</artifactId>
                <version>1.3.2</version>
                <executions>
                    <execution>
                        <id>Generate MyBatis Artifacts</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    &lt;!&ndash; generator 工具配置文件的位置 &ndash;&gt;
                    <configurationFile>src/main/resources/mybatis-generator/generatorConfig.xml</configurationFile>
                    <verbose>true</verbose>
                    <overwrite>true</overwrite>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>mysql</groupId>
                        <artifactId>mysql-connector-java</artifactId>
                        <version>5.1.34</version>
                    </dependency>
                    <dependency>
                        <groupId>org.mybatis.generator</groupId>
                        <artifactId>mybatis-generator-core</artifactId>
                        <version>1.3.2</version>
                    </dependency>
                </dependencies>
            </plugin>-->
            <!--引用本地jar包-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                    <!--根据你把lib放的位置,但需要注意的是,mac平台上,路径分隔符用的"/",windows下用的分隔符是"\"-->
                    <compilerArguments>
                        <extdirs>src\main\resources\lib</extdirs>
                    </compilerArguments>
                </configuration>
            </plugin>
        </plugins>
    </build>

4.需要跳过test,我使用的是第三种方式

https://blog.csdn.net/qq_42222230/article/details/105685293?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param

5.使用maven打包操作只能有一个主运行类

上述注意点做好之后就可以开始打包操作了

打包操作:

1.使用idea右边框中的 Maven Projects -> 项目名 -> Lifecycle -> clean
2.使用Maven Projects -> 项目名 -> Lifecycle -> install

6.最后在jar包所在文件打开命令窗口,使用命令运行

进入jar包所在文件夹

cd /usr/local/xxx

查询端口命令
netstat -lnp|grep 8088
运行命令
nohup java -jar aifactory-0.0.1-SNAPSHOT.jar

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值