Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 350161 - Opening Parent POM in Editor corrupts repository file
Summary: Opening Parent POM in Editor corrupts repository file
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: m2e (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P2 critical (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 352543 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-06-23 11:54 EDT by Ben Tatham CLA
Modified: 2021-04-19 13:25 EDT (History)
5 users (show)

See Also:


Attachments
Maven Console (758 bytes, text/plain)
2011-06-23 13:50 EDT, Ben Tatham CLA
no flags Details
settings.xml (1.80 KB, text/xml)
2011-07-20 08:05 EDT, Tom Zauner CLA
no flags Details
settings.xml that reproduces the problem (919 bytes, application/xml)
2011-07-20 09:10 EDT, Holger Oehm CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Tatham CLA 2011-06-23 11:54:06 EDT
After using Ctrl+Click on the <parent> element to view the parent pom in the m2e pom editor view, that pom file becomes corrupted in the local repository.

Looking in the local repository itself, the file becomes 0 bytes in length.

This causes failures inside (when updating project) and outside of eclipse:

c:\work\ApolloServer\BenTatham>mvn validate
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project ca.nanometrics.apollo:ApolloServer:2.1.1-SNAPSHOT (c:\work\ApolloServer\BenTatham\pom.xml) has 1 error
[ERROR]     Non-readable POM C:\tools\maven\repository\ca\nanometrics\maven\web-common-pom-java6\4.1.2\web-common-pom-java6-4.1.2.pom: input contained no data @ C:\tools\maven\repository\ca\nanometrics\maven\web-common-pom-java6\4.1.2\web-common-pom-java6-4.1.2.pom
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
c:\work\ApolloServer\BenTatham>

Eclipse IDE for Java Developers

Version: Indigo Release
Build id: 20110615-0604
eclipse.buildId=I20110613-1736
M2E 1.0.0.20110607-2117
jdk1.6.0_25
os.arch=amd64
os.name=Windows 7
os.version=6.1
Comment 1 Milos Kleint CLA 2011-06-23 12:34:40 EDT
I've tried with a few of our own codebases but could not reproduce, however I'm on Mac, not Windows.

is this 100% reproducible for you or just a one time (random) event?
Any additional details, steps to reproduce, logs etc appreciated.
Comment 2 Ben Tatham CLA 2011-06-23 13:50:59 EDT
Created attachment 198484 [details]
Maven Console

This is the maven console view when I ctrl+clicked the parent element.

It happens on all my projects consistently and repeatedly, with different parent poms (although they are all part of the same pom hierarchy).  If I blow away the broken pom's directory in my local repo filesystem, it happens again the next time too.
Comment 3 Ben Tatham CLA 2011-06-23 13:58:51 EDT
I was using vrapper as well (http://vrapper.sourceforge.net/home/) and thought that might be the culprit, but I uninstalled that, and I still get the same behaviour.

The only message related in the Error Log is the same one in the maven console:

JAR will be empty - no content was marked for inclusion!  

An exception stack trace is not available.

eclipse.buildId=I20110613-1736
java.version=1.6.0_25
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_CA
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product
Comment 4 Milos Kleint CLA 2011-06-23 14:27:49 EDT
Installing C:\tools\maven\repository\ca\nanometrics\maven\common-pom-libgcj\4.1.2\common-pom-libgcj-4.1.2.pom to C:\tools\maven\repository\ca\nanometrics\maven\common-pom-libgcj\4.1.2\common-pom-libgcj-4.1.2.pom


is the common-pom-libgcj-4.1.2.pom the parent pom in question?

I'm not sure where this logs are coming from, it looks like a maven-install-plugin log entry.. the weird part here is that both the origin and destination locations are equal. So maybe some part of m2e is performing a build on the location in the local repository of yours?

BTW: by any chance do you have the c:\tools\ path (or any of it's children) in the eclipse workspace?
Comment 5 Ben Tatham CLA 2011-06-23 16:06:35 EDT
(In reply to comment #4)
> is the common-pom-libgcj-4.1.2.pom the parent pom in question?

yes, common-pom-libgcj:4.1.2 is the parent pom in question.

> I'm not sure where this logs are coming from, it looks like a
> maven-install-plugin log entry.. the weird part here is that both the origin
> and destination locations are equal. So maybe some part of m2e is performing a
> build on the location in the local repository of yours?

sounds like its installing a 0B jar as the pom itself for the parent project...it definitely sounds like you're on to something.  I don't have any extra config for the maven-install-plugin in any of my parent poms...The only entry in my effective pom is from the Maven Super POM:

      <plugin>
        <artifactId>maven-install-plugin</artifactId>
        <version>2.3.1</version>
        <executions>
          <execution>
            <id>default-install</id>
            <phase>install</phase>
            <goals>
              <goal>install</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

> BTW: by any chance do you have the c:\tools\ path (or any of it's children) in
> the eclipse workspace?

no.  my workspaces are all in c:\work\...
Comment 6 Tom Zauner CLA 2011-06-30 08:47:06 EDT
Same problem for me. Parent pom gets corrupted when opening via pom editor (empty file).

Tried same setup / workspace on Linux Ubuntu 11.4 and Mac.
* works on Mac
* files gets corrupted on Ubuntu 11.4

Problem occured
Failed to load Effective POM
Can't read Maven project
Some problems were encountered while processing the POMs:
[FATAL] Non-readable POM .../.m2/repository/org/apache/struts/struts2-core/2.2.3-sg-1.7/struts2-core-2.2.3-sg-1.7.pom: input contained no data @ 

Some problems were encountered while processing the POMs:
[FATAL] Non-readable POM .../.m2/repository/org/apache/struts/struts2-core/2.2.3-sg-1.7/struts2-core-2.2.3-sg-1.7.pom: input contained no data @
Comment 7 Milos Kleint CLA 2011-07-20 04:30:15 EDT
*** Bug 352543 has been marked as a duplicate of this bug. ***
Comment 8 Milos Kleint CLA 2011-07-20 04:47:59 EDT
by any chance, do your affected projects define the build/defaultGoal element in the pom? (or more precisely does the defaultGoal element show up in the effective pom of the affected project?)
Comment 9 Tom Zauner CLA 2011-07-20 05:08:55 EDT
(In reply to comment #8)
> by any chance, do your affected projects define the build/defaultGoal element
> in the pom? (or more precisely does the defaultGoal element show up in the
> effective pom of the affected project?)

our affected pom doesnt have a defaultGoal. 

As posted above: the same pom file gets corrupted with Ubuntu 11.4 and Eclipse 3.7, while it doesnt corrupt with Mac and Eclipse 3.7. So might be independent to its content.
Comment 10 Milos Kleint CLA 2011-07-20 07:30:03 EDT
I suspect the problematic code is the SelectionUtils.readMavenProject() method which calls IMaven.execute() but shall be doing something along the IMaven.readProject() lines. I cannot verify the theory though as I still cannot reproduce locally.. 

The execute() method is definitely weird to be called on pom files from local repository..
Comment 11 Igor Fedorenko CLA 2011-07-20 08:01:20 EDT
Can people affected by the problem attach their user settings.xml (stripped off credentials and other sensitive info, of course)?
Comment 12 Tom Zauner CLA 2011-07-20 08:05:39 EDT
Created attachment 199979 [details]
settings.xml

Looking over it, there aint anything special in there.
Comment 13 Holger Oehm CLA 2011-07-20 09:10:49 EDT
Created attachment 199992 [details]
settings.xml that reproduces the problem

I removed all the profile stuff from my settings.xml and I can still reproduce the problem.
Comment 14 Holger Oehm CLA 2011-07-20 11:12:01 EDT
(In reply to comment #8)
> by any chance, do your affected projects define the build/defaultGoal element
> in the pom? (or more precisely does the defaultGoal element show up in the
> effective pom of the affected project?)

Yes, I did a "mvn help:effective-pom" in the child project, and the result contained this:
     <defaultGoal>clean install</defaultGoal>
Comment 15 Holger Oehm CLA 2011-07-20 11:22:28 EDT
That question about the defaultGoal made me curious: I removed the defaultGoal tag from the parent pom file in the local repository and the problem didnt occur the next time I tried the "Open Parent POM" action!
Comment 16 Milos Kleint CLA 2011-07-20 11:27:27 EDT
Cool, that sort of confirms my theory with execute() vs readProject()... 

(In reply to comment #15)
> That question about the defaultGoal made me curious: I removed the defaultGoal
> tag from the parent pom file in the local repository and the problem didnt
> occur the next time I tried the "Open Parent POM" action!
Comment 17 Milos Kleint CLA 2011-07-26 02:47:13 EDT
I've replaced the execute() call with readProject(). That shall avoid the problem if default goals kicking in.
http://git.eclipse.org/c/m2e/m2e-core.git/commit/?id=93179f239cac8aab9f4f59c4fe9df995eb3d872c


please verify by installing m2e from this url and testing with your projects and setup.  Thanks a lot.
https://repository.sonatype.org/content/repositories/forge-sites/m2e/1.0.100/N/LATEST/
Comment 18 Holger Oehm CLA 2011-07-26 03:28:21 EDT
(In reply to comment #17)
> please verify by installing m2e from this url and testing with your projects
> and setup.

Verified. Parent pom is no longer corrupted.
Comment 19 Denis Roy CLA 2021-04-19 13:25:32 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/