tags:

views:

975

answers:

6

I have recently started exploring Maven, but I feel a bit overwhelmed of all xml configuration in all the pom files. Are there any good tools i can use?

+1  A: 

When I edit any XML files, I use vim with the xmledit plugin.

Another good tool for XML editing is XMLmind XML editor. It's free for non-commercial use. It supports validating XML with W3C XML Schema (and other schema formats), so you can be sure to produce valid POM format.

Bill Karwin
+7  A: 

m2eclipse, it provides a very nice form-based editor. But I only use the XML view most of the time.

Joachim Sauer
m2eclipse supports some basic options, but to configure plugins the editor switches to XML view where you have to change settings manually.To me, a good editor should support the the often used Maven plugins and hide the XML configuration as much as possible.
Kwebble
It is nice but heavy. It'd be nice to have a light weight editor handle this
Peter Kahn
A: 

I don't. I use buildr, which has a lot more compact ruby based syntax to describe your project.

JtR
can buildr-created artifacts be uploaded to Maven repositories (including generated pom)? If they can't, then it seems somewhat leech-like to me.
Joachim Sauer
Sure you can with upload task.
JtR
A: 

You'll get used to it. Maven configuration files can be really short if you wanted to. You only need to have something in the pom.xml to override the default value.

If you stick to the default Maven directory structure, you won't need a long Maven at all.

Pyrolistical
At least, you won't need a long Maven file until your project grows beyond the trivial stage. But then, you also don't have much of an editing problem either. For a non-trivial project, many people are advocating the escape from an XML-based build script in favor of using an actual application language (e.g., Python using SCons and/or buildbot).
Rob Williams
A: 

If you are stuck with Maven, then you will simply need to read their documentation, Google like crazy for what is not documented, and experiment. Obviously, any editor capable of handling XML is suitable, and your preferences should dominate the choice.

On the other hand, if you are not stuck with Maven, then I HIGHLY recommend that you jump ship. I have used Maven for several years, along with many other build tools, and Maven is the worst: it is too complicated, it is obtuse, it is VERY hard to customize or extend, and it is slower. So, switch to something else.

I recommend Ant+Ivy or a Python-based solution.

Rob Williams
That's not really answering the question…
Dominic Mitchell
Sometimes the best answer to the question is to suggest changing the question, and your context. In other words, if you don't like the solutions to your problem, change your problem.
Rob Williams
A: 

This tip works with any good XML editor.

By far the best guide you can have is the XML schema (the 'XSD' file), which defines all the structures and what they do.

At the top of your POM, ensure the 'project' element is defined like this:

<project
  xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;

Now when you edit the file in any good editor (including jEdit or Eclipse) the editor will actually download the .xsd file from the URL above and use it to guide you and validate the POM.

e.g. in Eclipse, go somewhere in the POM and hit Ctrl-Space - it will bring up a list of valid elements for the current position.

Air
No idea what this downvote was for - this is still one of the better ways to edit POMs without constantly referring to the docs.
Air