rXp*_*rXp 2 java debugging javafx intellij-idea maven
我有一个旧的 javafx 应用程序,我必须通过执行来运行mvn javafx:run它,但现在我想用 intellij idea 来调试它。
如果我调试用于运行它的配置,调试器会连接,但不会在任何断点处停止。
如果我尝试运行 mvn 命令(例如mvn -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=6666" javafx:run并与远程连接),我会收到此错误(来自调试器):
java.util.ServiceConfigurationError:com.sun.jdi.connect.Connector:提供程序
sun.jvm.hotspot.jdi.SACoreAttachingConnector 未找到 java.util.ServiceConfigurationError: com.sun.jdi.connect.Connector: Provider
sun.jvm.hotspot.jdi.SADebugServerAttachingConnector 未找到 java.util.ServiceConfigurationError: com.sun.jdi.connect.Connector: Provider
sun.jvm.hotspot.jdi.SAPIDAttachingConnector 未找到
sa-jdwp服务器已连接
我不确定我需要做什么才能调试它。
pom.xml:
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>groupId</groupId>
<artifactId>ProjectId</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<!-- necessary for intellij to function -->
<maven.compiler.source>1.11</maven.compiler.source>
<maven.compiler.target>1.11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.10</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>14-ea+7</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
<version>14-ea+7</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>14-ea+7</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>14-ea+7</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.4.0-b180830.0359</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.4.0-b180830.0438</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.7.6-RC2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.3</version>
<configuration>
<mainClass>project.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>
Run Code Online (Sandbox Code Playgroud)
rXp*_*rXp 11
我找到了一种通过在 pom.xml 中创建调试执行然后使用 intellij idea 远程调试它来进行调试工作的方法。
我现在可以运行:mvn clean javafx:run@debug
我的 pom.xml 的新版本:
<build>
<plugins>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.3</version>
<executions>
<execution>
<id>run</id>
<configuration>
<mainClass>project.Main</mainClass>
</configuration>
</execution>
<execution>
<id>debug</id>
<configuration>
<mainClass>project.Main</mainClass>
<options>
<option>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:8000</option>
</options>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4434 次 |
| 最近记录: |