You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Frank Wilson <fa...@gmail.com> on 2014/10/01 15:18:32 UTC

Test Harness, how to wire a MavenProjectHelper

Hi,

Please could someone explain how to wire a MavenProjectHelper into my
mojo using the test harness?

I try to wire it using the test pom, however it seems the
MavenProjectHelpers dependencies are not satisfied.

Here's the line in my test POM:

https://github.com/zenlambda/fabric8/blob/mule-enable_fabric_deploy/fabric8-maven-plugin/src/test/resources/unit/forked-project-attachments/mule-test/pom.xml#L38

Here is the test:

https://github.com/zenlambda/fabric8/blob/mule-enable_fabric_deploy/fabric8-maven-plugin/src/test/java/io/fabric8/maven/ForkedTestValidatorTest.java#L30

The mojo I am trying to execute fails here:

https://github.com/zenlambda/fabric8/blob/mule-enable_fabric_deploy/fabric8-maven-plugin/src/test/java/io/fabric8/maven/probes/AttachZipMojo.java#L52


Because of a null pointer exception here:

https://github.com/apache/maven/blob/maven-3.0.5/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectHelper.java#L70

presumably because the requirement wasn't satisfied.

https://github.com/apache/maven/blob/maven-3.0.5/maven-core/src/main/java/org/apache/maven/project/DefaultMavenProjectHelper.java#L40

Stacktrace:

java.lang.NullPointerException
    at org.apache.maven.project.DefaultMavenProjectHelper.attachArtifact(DefaultMavenProjectHelper.java:70)
    at io.fabric8.maven.probes.AttachZipMojo.execute(AttachZipMojo.java:52)
    at io.fabric8.maven.ForkedTestValidatorTest.testNoApparentAttachmentsWhenMojoForksLifecycle(ForkedTestValidatorTest.java:37)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
    at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:74)
    at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:211)
    at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)

Why isn't plexus satisfying the requirement?

Thanks,

Frank

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org