注意点:
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>
<!– generator 工具配置文件的位置 –>
<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,我使用的是第三种方式
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