Skip to content
New issue

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

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

Already on GitHub? # to your account

Maven archetype example fails with NullPointerException #5285

Closed
jessebarnum opened this issue Mar 22, 2023 · 1 comment
Closed

Maven archetype example fails with NullPointerException #5285

jessebarnum opened this issue Mar 22, 2023 · 1 comment

Comments

@jessebarnum
Copy link

When I tried to follow the instructions for creating a sample project at https://eclipse-ee4j.github.io/jersey.github.io/documentation/latest/getting-started.html, I get a NullPointerException:

mkdir JerseyExample2

cd JerseyExample2

mvn archetype:generate -DarchetypeArtifactId=jersey-quickstart-grizzly2 -DarchetypeGroupId=org.glassfish.jersey.archetypes -DinteractiveMode=false -DgroupId=com.example -DartifactId=simple-service -Dpackage=com.example -DarchetypeVersion=2.39

cd simple-service/

mvn clean test


T E S T S

Running com.example.MyResourceTest
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.005 sec <<< FAILURE!
com.example.MyResourceTest.testGetIt() Time elapsed: 0.004 sec <<< FAILURE!
java.lang.NullPointerException
at com.example.MyResourceTest.testGetIt(MyResourceTest.java:45)

@jansupol
Copy link
Contributor

jansupol commented Mar 22, 2023

Yes, sorry for that. It is caused by migrating to Junit 5, where Junit 5 does not run @BeforeEach. It can be fixed by adding

            <plugin>
                <!-- Surefire support for JUnit-5 -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M7</version>
            </plugin>

It is fixed by #5277

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants