-
Notifications
You must be signed in to change notification settings - Fork 101
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
fix: NPE because declared MavenSession field hides field of superclass #439
Conversation
@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. |
@sebthom - thanks ... it is very strange that no IT detect it ... |
@sebthom can you provide a configuration which cause it, we can add such case as IT |
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 |
Thanks I will add it as IT tomorrow or at weekend unless you do it 😄 |
@slawekjaranowski I added the integration test |
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 session
resulting in one being not populated by Mavens DI.This PR fixes the issue by removing the redundant
session
field from the ExecMojo.The issue does not seem to be reproducible in the integration tests, so I cannot provide a new test case.
Stacktrace: