Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 352543

Summary: "Open Parent POM" overwrites parent pom in local repository with zero bytes content
Product: z_Archived Reporter: Holger Oehm <holger.oehm>
Component: m2eAssignee: Project Inbox <m2e.core-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: mkleint
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description Holger Oehm CLA 2011-07-20 04:26:35 EDT
I have one project in my workspace and I can open its pom.xml with the pom editor.
This pom.xml references a parent pom in a different project which is not imported into my workspace. When I press the button with the hint "Open Parent POM", the pom editor opens with the contents of the parent pom.xml (so far this is expected).

But at the same time I can see that the pom.xml in the local repository gets overwritten with empty content (0 bytes).

Any further action with the project in my workspace results in errors ("Project build error: Non-readable POM ...: input contained no data").

When I delete the (empty) file in the local directory and do a "Maven->Update Dependencies..." from the context menu of the project, the file is restored from the repository.



I debugged into the problem and this is what I found out:

The overwrite of the parent pom file is triggered from a Job that is created at 
{code}
	org.eclipse.m2e.editor.pom.MavenPomEditor.reloadMavenProjectCache() line: 1041	
{code}

The job is immediatly scheduled, here is a stacktrace (while logging the info message "Installing ... to ..."):

{code}
Thread [Worker-12] (Suspended (breakpoint at line 44 in org.eclipse.m2e.core.internal.embedder.EclipseLogger))	
	org.eclipse.m2e.core.internal.embedder.EclipseLogger.info(java.lang.String) line: 44	
	org.apache.maven.LoggingRepositoryListener.artifactInstalling(org.sonatype.aether.RepositoryEvent) line: 44	
	org.sonatype.aether.impl.internal.DefaultRepositoryEventDispatcher.dispatch(org.sonatype.aether.RepositoryEvent, org.sonatype.aether.RepositoryListener) line: 210	
	org.sonatype.aether.impl.internal.DefaultRepositoryEventDispatcher.dispatch(org.sonatype.aether.RepositoryEvent) line: 178	
	org.sonatype.aether.impl.internal.DefaultInstaller.artifactInstalling(org.sonatype.aether.RepositorySystemSession, org.sonatype.aether.RequestTrace, org.sonatype.aether.artifact.Artifact, java.io.File) line: 333	
	org.sonatype.aether.impl.internal.DefaultInstaller.install(org.sonatype.aether.RepositorySystemSession, org.sonatype.aether.RequestTrace, org.sonatype.aether.artifact.Artifact) line: 259	
	org.sonatype.aether.impl.internal.DefaultInstaller.install(org.sonatype.aether.SyncContext, org.sonatype.aether.RepositorySystemSession, org.sonatype.aether.installation.InstallRequest) line: 205	
	org.sonatype.aether.impl.internal.DefaultInstaller.install(org.sonatype.aether.RepositorySystemSession, org.sonatype.aether.installation.InstallRequest) line: 162	
	org.sonatype.aether.impl.internal.DefaultRepositorySystem.install(org.sonatype.aether.RepositorySystemSession, org.sonatype.aether.installation.InstallRequest) line: 473	
	org.apache.maven.artifact.installer.DefaultArtifactInstaller.install(java.io.File, org.apache.maven.artifact.Artifact, org.apache.maven.artifact.repository.ArtifactRepository) line: 106	
	org.apache.maven.plugin.install.InstallMojo.execute() line: 89	
	org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(org.apache.maven.execution.MavenSession, org.apache.maven.plugin.MojoExecution) line: 107	
	org.apache.maven.lifecycle.internal.MojoExecutor.execute(org.apache.maven.execution.MavenSession, org.apache.maven.plugin.MojoExecution, org.apache.maven.lifecycle.internal.ProjectIndex, org.apache.maven.lifecycle.internal.DependencyContext) line: 209	
	org.apache.maven.lifecycle.internal.MojoExecutor.execute(org.apache.maven.execution.MavenSession, org.apache.maven.plugin.MojoExecution, org.apache.maven.lifecycle.internal.ProjectIndex, org.apache.maven.lifecycle.internal.DependencyContext, org.apache.maven.lifecycle.internal.PhaseRecorder) line: 153	
	org.apache.maven.lifecycle.internal.MojoExecutor.execute(org.apache.maven.execution.MavenSession, java.util.List<org.apache.maven.plugin.MojoExecution>, org.apache.maven.lifecycle.internal.ProjectIndex) line: 145	
	org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(org.apache.maven.execution.MavenSession, org.apache.maven.execution.MavenSession, org.apache.maven.lifecycle.internal.ReactorContext, org.apache.maven.project.MavenProject, org.apache.maven.lifecycle.internal.TaskSegment) line: 84	
	org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(org.apache.maven.execution.MavenSession, org.apache.maven.lifecycle.internal.ReactorContext, org.apache.maven.project.MavenProject, org.apache.maven.lifecycle.internal.TaskSegment) line: 59	
	org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(org.apache.maven.execution.MavenSession, org.apache.maven.lifecycle.internal.ReactorContext, org.apache.maven.lifecycle.internal.ProjectBuildList, java.util.List<org.apache.maven.lifecycle.internal.TaskSegment>, org.apache.maven.lifecycle.internal.ReactorBuildStatus) line: 183	
	org.apache.maven.lifecycle.internal.LifecycleStarter.execute(org.apache.maven.execution.MavenSession) line: 161	
	org.apache.maven.DefaultMaven.doExecute(org.apache.maven.execution.MavenExecutionRequest) line: 319	
	org.apache.maven.DefaultMaven.execute(org.apache.maven.execution.MavenExecutionRequest) line: 156	
	org.eclipse.m2e.core.internal.embedder.MavenImpl.execute(org.apache.maven.execution.MavenExecutionRequest, org.eclipse.core.runtime.IProgressMonitor) line: 249	
	org.eclipse.m2e.core.ui.internal.actions.SelectionUtil.readMavenProject(java.io.File, org.eclipse.core.runtime.IProgressMonitor) line: 328	
	org.eclipse.m2e.core.ui.internal.actions.SelectionUtil.getMavenProject(org.eclipse.ui.IEditorInput, org.eclipse.core.runtime.IProgressMonitor) line: 305	
	org.eclipse.m2e.editor.pom.MavenPomEditor.readMavenProject(boolean, org.eclipse.core.runtime.IProgressMonitor) line: 734	
	org.eclipse.m2e.editor.pom.MavenPomEditor$7.run(org.eclipse.core.runtime.IProgressMonitor) line: 1046	
	org.eclipse.core.internal.jobs.Worker.run() line: 54	
{code}

When I track back (Step return) to stack frame "org.sonatype.aether.impl.internal.DefaultInstaller.install(org.sonatype.aether.RepositorySystemSession, org.sonatype.aether.installation.InstallRequest) line: 162	", the file in my local repositroy has 0 bytes.
Comment 1 Milos Kleint CLA 2011-07-20 04:30:15 EDT
duplicate of 350161

*** This bug has been marked as a duplicate of bug 350161 ***
Comment 2 Denis Roy CLA 2021-04-19 13:23:57 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/