microsoft / microsoft/vscode-java-test

Ignoring arg from maven plugin

オープン
#1,810 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

ai-triaged bug junit needs-reproduction test-execution
主要言語
TypeScript
スター
340
フォーク
173
平均マージ
1日 19時間
マージ済み PR(30日)
18

説明

When I run my java spring boot app tests through the UI (the play button), the console shows the warning about java agent being loaded dynamically:

Mockito is currently self-attaching to enable the inline-mock-maker. This will no longer work in future releases of the JDK. Please add Mockito as an agent to your build as described in Mockito's documentation: https://javadoc.io/doc/org.mockito/mockito-core/latest/org.mockito/org/mockito/Mockito.html#0.3
WARNING: A Java agent has been loaded dynamically (/var/home/npessoa/.m2/repository/net/bytebuddy/byte-buddy-agent/1.17.7/byte-buddy-agent-1.17.7.jar)
WARNING: If a serviceability tool is in use, please run with -XX:+EnableDynamicAgentLoading to hide this warning
WARNING: If a serviceability tool is not in use, please run with -Djdk.instrument.traceUsage for more information
WARNING: Dynamic loading of agents will be disallowed by default in a future release

As seen in this stackoverflow post for example, or even in the documentation linked in the warning from the console, this can be resolved by setting up the maven surefire or failsafe plugins with the argLine like this:

<argLine>@{argLine} -javaagent:${settings.localRepository}/org/mockito/mockito-core/${mockito.version}/mockito-core-${mockito.version}.jar</argLine>

That's enough to make the warning go away on my CI/CD pipelines or running the tests through the Intellij IDEA UI. But in the case of vscode, I had to edit my settings.json to include this config, having even to replace the placeholders with static values:

"java.test.config": {
  "vmArgs": [
    "-javaagent:/var/home/npessoa/.m2/repository/org/mockito/mockito-core/5.17.0/mockito-core-5.17.0.jar",
    "-Xshare:off"
  ]
}

I'm not sure I'm bringing this up in the appropriate place, but I guessed the vscode-java-test plugin could be responsible for this, so I though posting this here.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

UI の再生ボタンで使用される Java テスト起動パスから始め、java.test.config vmArgs が Maven surefire または failsafe argLine と併せてどのように処理されるかを調べます。生成されたテストコマンドを、文書化されている Mockito javaagent の設定と比較します。VS Code 経由でテストを起動したときに設定済みのエージェント引数が反映され、動的ロードの警告が報告されなくなれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java, vscode
領域
testing, tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。