views:

104

answers:

3

Is it true that the only configuration file I need to bother with is pom.xml ?

It seems to me that Java guys live xml more than any other stuff,is that true?

+1  A: 

You probably want to give some attention to the settings.xml file too. However, for the most part you are correct, everything is in the pom.xml

dbyrne
Sigh...Why doesn't maven use `scripts` for this kind of job, I don't see `xml` has any advantage here, which is why I don't like `ant`..
Validation is a big one for the end user. Easy data binding is another for the Maven programmer. Reminder: POM is a OBJECT MODEL not a script language so you don't need to worry about writing "code" in the XML.
Chris Nava
Building process is more programatical than configurable. Say we should use scripts than xml to do this kind of job.
Also, using XML allows IDE builders to wrap the POM file in a GUI.
Chris Nava
Have you actually looked at a pom.xml file? There's no programmatic logic elements in there.
Chris Nava
@user198729 *Building process is more programatical than configurable* Not with Maven.
Pascal Thivent
+2  A: 

Is it true that the only configuration file I need to bother with is pom.xml ?

Yes, Maven uses a pom.xml file to describe a project's medata and extend Maven's behavior, which also known as the Project Object Model (POM) file.

Maven will also look by default for a per user configuration file in ~/.m2/settings.xml but this file is optional.

Why doesn't maven use scripts for this kind of job, I don't see xml has any advantage here, which is why I don't like ant

What should Maven have used in 2002 if not XML? Makefiles? In my opinion, XML was and still is a very decent choice for a declarative Project Object Model. Yes XML is verbose but it is perfect for the job and allows to benefit from nice things like validation, transformation, code completion which seem important to me.

Now, nothing forces you to use Maven if you don't like it and feel free to use Gradle or Gant or Buildr (if the size of their communities is not a concern).

Just in case, note that Maven 3 offers polyglot support (see this post and this one) but as I said, writing a pom in Groovy, YAML, etc doesn't only have advantages (e.g. validation).

Pascal Thivent
Maven 3 is a future version...BTW, does `Gradle` or `Gant` support script instead of xml?
@user198729 The future is closer than you think. Maven 3.x is already embedded in IDEs like NetBeans or Eclipse, the Beta 1 is available and all my projects are building fine with it. Regarding Gradle, Gant, Buildr, just check the links.
Pascal Thivent
+3  A: 

Maven uses XML for POM files because XML is a good choice for describing things ... and a POM file is a description of a project. I supposed that the Maven implementors could have invented a custom language, but then lots of people would have complained about having to learn another language syntax.

It would make no sense to express Maven POM files in some kind of scripting language because they are not "scripts" in any recognizable sense.

It seems to me that Java guys live xml more than any other stuff,is that true?

No. "Java guys" use all sorts of technologies for configuring things: XML, JSON, properties files, databases, bespoke languages, you name it someone has used it.

If your problem is that you hate using XML, either:

  • get over it,
  • get an editor that hides the XML syntax from you,
  • use (shudder) Make,
  • use (whimper) build scripts written in some clunk old scripting language, or
  • go away and implement a better solution.

But I'll stick with Maven, thanks.

Stephen C
In fact building is more than configuration, say, xml is not fit for this kind of job.
@user1982729 - 1) I did not say anything about configuration. 2) Maven builds a project by ... understanding the description in the POM files. No explicit build scripting is required.
Stephen C
@user1982729 - BTW, as a self-descibed Maven newbie, you are *not qualified* to make pronouncements whether Maven should or should not use XML as its project description language. Wait until you understand what Maven is doing and why it is doing before you start lobbing stink bombs at it.
Stephen C