<?xml version="1.0" encoding="UTF-8"?> <project xsi:schemalocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <parent> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-parent</artifactid> <version>2.1.4.RELEASE</version> <relativepath></relativepath> <!-- lookup parent from repository --> </parent> <groupid>com.remote.test</groupid> <artifactid>remote_test</artifactid> <version>0.0.1-SNAPSHOT</version> <name>remote_test</name> <description>Demo project for Spring Boot</description> <properties> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter</artifactid> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-test</artifactid> <scope>test</scope> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-web</artifactid> </dependency> <dependency> <groupid>org.junit.jupiter</groupid> <artifactid>junit-jupiter-api</artifactid> <version>RELEASE</version> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-shade-plugin</artifactid> <version>2.2</version> <dependencies> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-maven-plugin</artifactid> <version>2.1.4.RELEASE</version> </dependency> </dependencies> <configuration> <keepdependencieswithprovidedscope>true</keepdependencieswithprovidedscope> <createdependencyreducedpom>false</createdependencyreducedpom> <filters> <filter> <artifact>*:*</artifact> <excludes> <exclude>META-INF/*.SF</exclude> <exclude>META-INF/*.DSA</exclude> <exclude>META-INF/*.RSA</exclude> </excludes> </filter> </filters> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <finalname>${project.artifactId}-${project.version}-all</finalname> <transformers> <transformer> <resource>META-INF/spring.handlers</resource> </transformer> <transformer> <resource>META-INF/spring.factories</resource> </transformer> <transformer> <resource>META-INF/spring.schemas</resource> </transformer> <transformer></transformer> <transformer> <!--根据项目的全名指定启动类--> <mainclass>com.remote.test.remote_test.RemoteTestApplication</mainclass> </transformer> </transformers> </configuration> </execution> </executions> </plugin> </plugins> </build> </project>rrree
Masukkan: mvn clean package
, (ia mungkin memerlukan beberapa minit), akhirnya Nasib baik, jika anda menentukan repositori tempatan sebelum membina, anda tidak perlu memuat turun semula pakej balang.
Nyatakan port soket = 8081 dan nyatakan port ke menjadi nyahpepijat Modul
a 🎜>
b Kemudian masukkan arahan dalam terminal: java -agentlib:jdwp=transport=dt_socket,server=n,address=localhost:8081 - jar remote_test-0.0. 1-SNAPSHOT-all.jar
5. Tandakan titik putus pada antara muka yang menyediakan permintaanNota: Nyahpepijat mesti dimulakan dalam IDEA dahulu, dan kemudian projek
➜ Desktop java -agentlib:jdwp=transport=dt_socket,server=n,address=localhost:8081 -jar remote_test-0.0.1-SNAPSHOT-all.jar
RALAT: ralat pengangkutan 202: sambung gagal: Sambungan ditolakRALAT: JDWP Transport dt_socket gagal dimulakan, TRANSPORT_INIT(510)
Ralat keluar JDWP AGENT_ERROR_TRANSPORT_INIT(197): Tiada pengangkutan dimulakan [debugInit.c:750]
Atas ialah kandungan terperinci Cara menggunakan sambungan jauh IDEA Debug dalam springboot. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!