Skip to content

Commit 70c774b

Browse files
committed
Fix javaagent arg when running in IntelliJ
Taking the summary from my conversation with Claude to fix this: 1. We needed afterEvaluate to ensure the project was fully configured before accessing its properties 2. The correct path was in build/distributions rather than build/libs 3. We had to properly handle Gradle's Provider API when constructing the path 4. The jar name needed to include both the archivesName and the project version Signed-off-by: Michael Froh <[email protected]>
1 parent d29e95c commit 70c774b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

gradle/ide.gradle

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ if (System.getProperty('idea.active') == 'true') {
4949
}
5050
}
5151

52+
buildScan {
53+
server = 'https://127.0.0.1'
54+
}
55+
5256
idea {
5357
project {
5458
vcs = 'Git'
@@ -81,8 +85,14 @@ if (System.getProperty('idea.active') == 'true') {
8185
}
8286
runConfigurations {
8387
defaults(JUnit) {
84-
vmParameters = '-ea -Djava.locale.providers=SPI,CLDR'
85-
vmParameters += ' -javaagent:' + project(':libs:agent-sm:agent').jar.archiveFile.get()
88+
project(':libs:agent-sm:agent').afterEvaluate { agentProject ->
89+
vmParameters = '-ea -Djava.locale.providers=SPI,CLDR'
90+
def jarName = "${agentProject.base.archivesName.get()}-${project.version}.jar"
91+
vmParameters += ' -javaagent:' + agentProject.layout.buildDirectory
92+
.dir('distributions')
93+
.map { it.file(jarName) }
94+
.get()
95+
}
8696
}
8797
}
8898
copyright {

0 commit comments

Comments
 (0)