IT story

intellij 아이디어로 Maven 목표를 디버깅하는 방법은 무엇입니까?

hot-time 2020. 9. 8. 21:57
반응형

intellij 아이디어로 Maven 목표를 디버깅하는 방법은 무엇입니까?


Intellij IDEA로 Maven 목표를 디버깅 할 수 있습니까? 마우스 오른쪽 버튼을 클릭하고 Debug를 실행할 수 있다는 것을 알고 있습니다 . 그러나 Maven 플러그인은 내 외부 라이브러리 목록에 나타나지 않으므로 코드로 이동하여 중단 점을 설정할 수 없습니다. 따라서 디버그Run 처럼 멈추지 않고 목표를 통해 실행됩니다 .

OS X 10.8 및 IDEA 12.0.2를 사용하고 있습니다.

수정 : 목표

https://github.com/searls/jasmine-maven-plugin에 대한 사용자 지정 specRunner를 작성했습니다. 그러나 $ specs $는 비어 있습니다. 그래서 어떤 파일이 실제로로드되는지 확인하려고합니다.


그것을 알아 냈습니다.

  1. 명령 줄에서와 목표를 받는다는 실행할 mvnDebug대신 mvn. mvnDebug clean
  2. intelliJ에서 디버깅하려는 Maven 플러그인의 소스를 열고 중단 점을 설정합니다.
  3. IDEA에서 Remote구성을 추가하십시오 .
    1. 설정에서 전송 : 소켓, 디버거 모드 : 연결, 호스트 : localhost, 포트 : 8000 (mvnDebug의 기본 포트)을 설정합니다.
  4. 디버그 모드에서 구성을 실행하십시오. 대기중인 mvnDebug jvm에 연결해야합니다.

아주 쉽게. Intellj Idea 15.0.4를 사용하고 있습니다.

  1. Maven 플러그인에서 중단 점 설정
  2. 태그 "Maven Projects"에서 마녀가 maven 플러그인을 사용하는 프로젝트로 이동합니다.
  3. "플러그인"에서 플러그인을 찾고 목표 위에 마우스 오른쪽 버튼을 클릭하고 디버그

다음은 스크린 샷입니다.

스크린 샷


오래된 질문이지만 동일한 필요가 있었고 작동하는 데 시간이 걸렸습니다. 누군가를 도울 수 있기를 바랍니다.

테스트 디버깅 사용 :

mvn <goal> -Dmaven.surefire.debug 

또는

mvn <goal> -Dmaven.failsafe.debug

When execution stops and listens to socket at address 5005 (default) you run your configured remote debugger.

How to configure it:

Run -> Edit configurations -> Remote Transport: socket Debugger mode: Attach Port: 5005 (default)

-> Save.


The easiest way to debug maven goal ONLY within IntelliJ is to create a regular maven goal and in the runner tab pass those VM options:

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000

Where 8000 is a port number for remote debugging.

Maven 목표 구성

Then create new Remote configuration with port 8000. Run this configuration after running maven goal.

원격 디버깅 구성


I think the easiest solution is to temporarily add the maven plugin as a dependency. Once this is done, IntelliJ will treat this just like any other dependency and you can set breakpoints the usual way.


Since you are working with Intellij, there is already a built-in debugger there and you do not need to necessarily use mvnDebug which is a command line tool. Check out this tutorial: How to Debug Maven Applications in Intellij IDEA.

The tutorial uses the Maven Exec Plugin and lets you debug the application without a need to use the command line or MvnDebug. Thought sharing it might be of value here.


Either You can refer to above answer Or just add this plugin to pom.xml

           <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
            <jvmArguments>
            -Xdebug - 
            Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000
            </jvmArguments>
            </configuration>
        </plugin>

And run maven goal with mvn instead of mvnDebug. E.g. mvn spring-boot:run

In IDEA, add a Remote Configuration. Under Settings, set Transport: Socket, Debugger Mode: Attach, Host: localhost, Port: 8000 (default port of mvnDebug).

Run as Debug in IDEA , whenever you want to debug the code.

참고 URL : https://stackoverflow.com/questions/14602540/how-to-debug-a-maven-goal-with-intellij-idea

반응형