Issue Details (XML | Word | Printable)

Key: MNGECLIPSE-13
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Eugene Kuleshov
Reporter: Michal Stochmialek
Votes: 16
Watchers: 13
Operations

If you were logged in you would be able to see more operations.
Maven Integration for Eclipse

adding dependency to pom.xml changes its formating

Created: 16/Dec/05 06:41 AM   Updated: 11/Mar/08 02:44 AM
Component/s: None
Affects Version/s: 0.0.3
Fix Version/s: 0.9.0

Time Tracking:
Not Specified

Environment: win xp, eclipse 3.1, plugin 0.0.3
Issue Links:
Duplicate
 
dependent
 


 Description  « Hide
I use pom.xml as a human-readable file, so I insert empty lines between main sections of pom etc. But after adding a depedency using maven plugin, those blank lines have disappeared.

The similar thing happened to indentions. I usually use tabs for indenting, but plugin changed whole file indenting to spaces. In result CVS diff shows that whole file have been changed.

Maven plugin should modify only lines that contain new (just added) dependency.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Eugene Kuleshov added a comment - 16/Dec/05 09:04 AM
This is actually limitation of maven-embedder component. I leave this issue hare as a task to track this dependency.

Michał Steiner added a comment - 23/Dec/05 03:53 AM
Adding dependency brokes also encoding ( UTF characters are changed to '?') and removes schema declaration from pom.xml.

Markus Härnvi added a comment - 14/Jun/06 03:41 AM
The schema declaration is a problem if you have a validating XML editor installed like XMLBuddy. It gives a lot of errors.

Jörg Hohwiller added a comment - 15/Aug/06 03:18 AM
It is NOT only the formatting that is changed. Also all comments get stripped out.
I use comments to document my dependencies since I am missing an appropriate tag in the POM XML format for that. In my case the m2eclipse plugin is causing information loss!

I can see the point that you want to use the maven internal code to parse the POM and using XPP will cause this problem. This is a very common problem when updating handwritten configurations automatically - no matter what format (properties, xml, ...) or project. Anyways from the usability point of view this is a serious problem that should be solved. Even if you need to parse the POM again using DOM or whatever.


Erick Dovale added a comment - 28/Sep/06 09:58 AM
Even if XmlBuddy doesn't know how to deal with schemas m2eclipse should not remove it. In my case I need to have the schema declaration to leverage my ide's code completion.

Ryan Sonnek added a comment - 08/Feb/07 09:57 AM
i think the "add dependency" wizard is a great idea, but since it reformats the pom.xml, it's been unusable for my projects.

Robert Elliot added a comment - 18/Apr/07 10:24 AM - edited
I think this should be rather higher priority - not being able to comment in a pom.xml or use the schema declaration at the same time as using the "add dependency" wizard is really fairly serious.
The "depends upon" MNG-1117 issue has now been marked close with a comment from a couple of months ago suggesting things may have improved?

Eugene Kuleshov added a comment - 15/Sep/07 09:02 PM
Jason, can you please check if MavenEmbedder.writeModel() call can be fixed to preserve formatting and comments upon update.

Eugene Kuleshov added a comment - 11/Mar/08 02:44 AM
Plugin is now using new model for editing Maven's pom.xml