fix: NPE because declared MavenSession field hides field of superclass#439
Merged
slawekjaranowski merged 1 commit intomojohaus:masterfrom Aug 11, 2024
Merged
fix: NPE because declared MavenSession field hides field of superclass#439slawekjaranowski merged 1 commit intomojohaus:masterfrom
slawekjaranowski merged 1 commit intomojohaus:masterfrom
Conversation
Contributor
Author
|
@slawekjaranowski I believe this issue qualifies for a timely 3.4.1 fix release. I would really appreciate if you find the time/capacity to merge and release this soon. |
Member
|
@sebthom - thanks ... it is very strange that no IT detect it ... |
Member
|
@sebthom can you provide a configuration which cause it, we can add such case as IT |
slawekjaranowski
approved these changes
Aug 7, 2024
Contributor
Author
|
You should be able to reproduce it with an empty maven project using the following pom.xml executing <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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>issue-439</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.4.0</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<includePluginDependencies>true</includePluginDependencies>
<executableDependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</executableDependency>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath />
<argument>org.junit.runner.JUnitCore</argument>
</arguments>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>Interestingly when you remove the section |
Member
|
Thanks I will add it as IT tomorrow or at weekend unless you do it 😄 |
Contributor
Author
|
@slawekjaranowski I added the integration test |
slawekjaranowski
approved these changes
Aug 9, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The exec goal plugin fails an NPE in the latest 3.4.0 release. The reason is that after the code changes of #432 AbstractExecMojo and ExecMojo declare an injectable
MavenSession sessionresulting in one being not populated by Mavens DI.This PR fixes the issue by removing the redundant
sessionfield from the ExecMojo.The issue does not seem to be reproducible in the integration tests, so I cannot provide a new test case.
Stacktrace: