Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-dev] Problems navigating the execution plan

Calculating a new execution plan is giving me an NPE problem.

I wrote:

IMaven maven = MavenPlugin.getDefault().getMaven();
    	MavenExecutionRequest mer = new DefaultMavenExecutionRequest();
    	List<String> goals = Collections.singletonList("deploy");
    	mer.setGoals(goals);
    	MavenExecutionPlan fullPlan = maven.calculateExecutionPlan(mer,
mavenProjectFacade.getMavenProject(monitor), monitor);


and I got the following.

!ENTRY org.eclipse.core.jobs 4 2 2011-01-15 10:11:48.852
!MESSAGE An internal error occurred during: "Updating Maven Configuration".
!STACK 0
java.lang.NullPointerException
	at org.apache.maven.DefaultMaven.newRepositorySession(DefaultMaven.java:352)
	at org.maven.ide.eclipse.internal.embedder.MavenImpl.createRepositorySession(MavenImpl.java:246)
	at org.maven.ide.eclipse.internal.embedder.MavenImpl.createSession(MavenImpl.java:235)
	at org.maven.ide.eclipse.internal.embedder.MavenImpl.calculateExecutionPlan(MavenImpl.java:292)
	at org.maven.ide.eclipse.extensions.shared.util.MavenPluginWrapper.findMojoExecution(MavenPluginWrapper.java:114)
	at org.maven.ide.eclipse.extensions.shared.util.MavenPluginWrapper.newInstance(MavenPluginWrapper.java:131)
	at org.maven.ide.eclipse.extensions.shared.util.AbstractMavenPluginProjectConfigurator.getMavenPlugin(AbstractMavenPluginProjectConfigurator.java:272)
	at
On Fri, Jan 14, 2011 at 10:35 PM, Igor Fedorenko <igor@xxxxxxxxxxxxxx> wrote:
> In 0.10.x and 0.12.x, mavenProjectFacade.getExecutionPlan(monitor) is
> expected to calculate execution plan up-to "package" phase inclusive
> (see #calculateExecutionPlan in [1]). It does not include "validate"
> phase. You need to call IMaven#calculateExecutionPlan from your code to
> get execution plan that includes "validate".
>
> In current master head we've changed mavenProjectFacade.getExecutionPlan
> to include all the way to "deploy" [2], so validate phase is included
> already.
>
> Also, beware that execution plan calculation is an expansive operation
> that may require remote repository access. We plan to change m2e core to
> avoid using it but instead only resolve "interesting" individual plugin
> executions. See MNGECLIPSE-2724 [3] for more info.
>
>
> [1]
> https://github.com/sonatype/m2e-core-tests/blob/rb-0.12.x/org.maven.ide.eclipse/src/org/maven/ide/eclipse/internal/project/registry/ProjectRegistryManager.java
>
> [2]
> http://git.eclipse.org/c/m2e/m2e-core.git/tree/org.eclipse.m2e.core/src/org/eclipse/m2e/core/internal/project/registry/ProjectRegistryManager.java
>
> [3] https://issues.sonatype.org/browse/MNGECLIPSE-2724
> --
> Regards,
> Igor
>
> On 11-01-14 07:38 PM, Benson Margulies wrote:
>>
>> In handing project config change requests, my plugin receives an
>> IMavenProjectFacade from M2E.
>>
>> Some phases seem to be trimmed out of there. In particularly, my users
>> complain that I'm failing to pay attention if their POM configures the
>> plugin in the 'verify' phase.
>>
>> The idea here is that I want to collect the effective configuration of
>> their actually configured execution of some specific goal of
>> checkstyle or findbugs.
>>
>> Can you suggest some alternative to the following that is likely to be
>> more satisfactory?
>>
>> Do I need to somehow ask maven to build a 'vanilla' execution plan
>> that I can then traverse?
>>
>> MavenExecutionPlan executionPlan =
>> mavenProjectFacade.getExecutionPlan(monitor);
>>        List<MojoExecution>  mojoExecutions =
>> executionPlan.getMojoExecutions();
>>        for (MojoExecution mojoExecution : mojoExecutions) {
>>                if(mojoExecutionForPlugin(mojoExecution, pluginGroupId,
>> pluginArtifactId, pluginGoal)) {
>>                        return mojoExecution;
>>                }
>>        }
>> _______________________________________________
>> m2e-dev mailing list
>> m2e-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/m2e-dev
>
> _______________________________________________
> m2e-dev mailing list
> m2e-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/m2e-dev
>


Back to the top