欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

springboot_工程部署

程序员文章站 2022-06-13 15:25:06
...

1.打包可执行jar工程文件:

工程右键->run as->maven build:

maven package

2.问题:[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

Window->preferences->Java->Installed JREs->Add->Standard VM->next->Directory->JDK root路径->Finish->[Installed JREs勾选添加的JDK]

Window->preferences->Java->Installed JREs->Execution Environments->JavaSE-1.8->[勾选JDK]

3.打包jar的pom配置:

<build>
  <plugins>
    <plugin>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-maven-plugin</artifactId>
      <executions>
        <execution>
          <goals>
            <goal>repackage</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>
</build>

4.执行jar包:

#开放端口
/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT

#执行jar包
java -jar package.jar