Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356725 - Calls to mavenProject.getParent() in BuildParticipants raise an IllegalStateException due to missing context session
Summary: Calls to mavenProject.getParent() in BuildParticipants raise an IllegalStateE...
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: m2e (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-05 08:13 EDT by Fred Bricon CLA
Modified: 2021-04-19 13:27 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Fred Bricon CLA 2011-09-05 08:13:25 EDT
Build Identifier: 

Bugs #355292 and #349986 affecting mavenarchiver and m2e-wtp plugins are caused by plugin configurations using project.parent.* properties.

As a matter of fact, calling mavenProject.getParent() in AbstractBuildParticipant.build() causes this exception :

java.lang.IllegalStateException: no context maven session
	at org.eclipse.m2e.core.internal.embedder.ContextRepositorySystemSessionImpl.getSession(ContextRepositorySystemSessionImpl.java:48)
	at org.eclipse.m2e.core.internal.embedder.ContextRepositorySystemSessionImpl.getMirrorSelector(ContextRepositorySystemSessionImpl.java:102)
	at org.sonatype.aether.impl.internal.DefaultRemoteRepositoryManager.aggregateRepositories(DefaultRemoteRepositoryManager.java:139)
	at org.apache.maven.project.ProjectModelResolver.addRepository(ProjectModelResolver.java:119)
	at org.apache.maven.model.building.DefaultModelBuilder.configureResolver(DefaultModelBuilder.java:567)
	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:306)
	at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:232)
	at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:135)
	at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:98)
	at org.apache.maven.project.MavenProject.getParent(MavenProject.java:359)

As a workaround, the parent projects can be manually loaded in each BuildParticipant implementations, but a proper solution would be to attach (and later detach) each project being built to the current maven session.

The same goes for projects being configured by project configurators.

 	

Reproducible: Always
Comment 1 Igor Fedorenko CLA 2013-06-08 10:42:54 EDT
@fred can you check if latest 1.4 is still affected? This issue may have been addressed as a side effect of introduction of IMavenExecutionContext.
Comment 2 Igor Fedorenko CLA 2013-09-09 22:31:04 EDT
Closing old/stale bugreport
Comment 3 Denis Roy CLA 2021-04-19 13:27:16 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/