Skip to content

Set jenkins.javaAgent in TestRuntimeMojo #1138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 4 additions & 27 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<frontend-version>1.15.1</frontend-version>
<gmavenplus-plugin.version>4.2.0</gmavenplus-plugin.version>
<hamcrest.version>3.0</hamcrest.version>
<hpi-plugin.version>3.64</hpi-plugin.version>
<hpi-plugin.version>3.65</hpi-plugin.version>
<incrementals-enforce-minimum.version>1.0-beta-4</incrementals-enforce-minimum.version>
<incrementals-plugin.version>1.8</incrementals-plugin.version>
<jacoco-maven-plugin.version>0.8.13</jacoco-maven-plugin.version>
Expand Down Expand Up @@ -113,6 +113,9 @@
<!-- Filled in by "maven-hpi-plugin" with the path to "org-netbeans-insane-hook.jar" extracted from "jenkins-test-harness" -->
<jenkins.insaneHook />

<!-- Filled in by "maven-hpi-plugin" with "-javaagent:/path/to/mockito-core-<version>.jar" -->
<jenkins.javaAgent />
Comment on lines +116 to +117
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will make the failure mode softer in the future by simply skipping a Java agent in the case that, for whatever reason, maven-hpi-plugin doesn't fill in this value.


<!--
The following bug patterns are noisy and create little value; therefore, we suppress them
globally.
Expand Down Expand Up @@ -503,17 +506,6 @@
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>properties</goal>
</goals>
</execution>
</executions>
</plugin>
Comment on lines -506 to -516
Copy link
Member Author

@basil basil May 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is handled via TestRuntimeMojo, which contains:

@Mojo(name = "test-runtime", requiresDependencyResolution = ResolutionScope.TEST)

<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
Expand Down Expand Up @@ -779,21 +771,6 @@
<!-- https://stackoverflow.com/a/4086207/12916 -->
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>configureJavaAgent</id>
<goals>
<goal>run</goal>
</goals>
<phase>initialize</phase>
<configuration>
<target>
<condition else="" property="jenkins.javaAgent" value="-javaagent:${org.mockito:mockito-core:jar}">
<isset property="org.mockito:mockito-core:jar" />
</condition>
</target>
<exportAntProperties>true</exportAntProperties>
</configuration>
</execution>
Comment on lines -782 to -796
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reimplemented with Java code in jenkinsci/maven-hpi-plugin#741.

<execution>
<id>createTempDir</id>
<goals>
Expand Down