6

In a POM-file i found a "maven-ear-plugin" configuration that uses "defaultJavaBundleDir", but it seems that "defaultLibBundleDir" is the correct (according to the schema and various documentation).

The Maven POM schema is version 4.0.0.

Is this a remnant from an older version? I couldn't find an explanation for this change, and would like to make sure we are using the correct notation reliably.

Jean-Rémy Revy
  • 5,607
  • 3
  • 39
  • 65
Brummo
  • 1,030
  • 2
  • 12
  • 18

2 Answers2

9

In a POM-file i found a "maven-ear-plugin" configuration that uses "defaultJavaBundleDir", but it seems that "defaultLibBundleDir" is the correct (according to the schema and various documentation).

Actually, the configuration element of a plugin can contain anything. So <foo>bar</foo> is valid (and will just be "ignored" by a given plugin if it's an unknown parameter).

Is this a remnant from an older version? I couldn't find an explanation for this change, and would like to make sure we are using the correct notation reliably.

This change has been introduced for the resolution of MEAR-46 as we can read in the (approximative) comment of the svn commit: r471886.

Added defaultLibDir as an alias of defaultJavaBundleDir which is more understable

If you look closer at the diff, you'll see that defaultLibBundleDir is the new name of the parameter and that the old defaultJavaBundleDir is declared as an alias.

So both work, both do the same thing, but only the "new" one is documented in the parameters list of the ear mojo. You can safely change to defaultLibBundleDir and this will make things more clear.

Pascal Thivent
  • 562,542
  • 136
  • 1,062
  • 1,124
  • 1
    Thanks for the reply. The strange thing is that "defaultJavaBundleDir" didnt work for building the EAR-file through hot deployment in Eclipse (i.e. using m2eclipse + WTP). That is, all jar files where put in the root folder of the EAR-file instead of the specified dir. But when I changed to "defaultLibBundleDir" it actually started working. Can this be due to how m2eclipse interprets the POM? – Brummo Nov 10 '10 at 16:37
  • Yes, that is the case. We had the same problem with m2e + WTP not deploying the EAR correctly, and changing "defaultJavaBundleDir" to "defaultJavaBundleDir" fixed it. – ocarlsen Apr 24 '14 at 11:43
  • Thank you. I was using "defaultJavaBundleDir" in my EAR pom.xml and the jars were never getting deployed to lib folder. Using "defaultLibDir" fixed it. – Reddymails Jan 25 '19 at 20:11
2

Also worth noting is that the Maven Integration for WTP eclipse plugin (m2e-wtp) only supports the documented defaultLibBundleDir option, not the older defaultJavaBundleDir.

https://github.com/eclipse/m2e.wtp/search?utf8=%E2%9C%93&q=defaultLibBundleDir https://github.com/eclipse/m2e.wtp/search?utf8=%E2%9C%93&q=defaultJavaBundleDir

Patrick Decat
  • 618
  • 5
  • 11
  • I wish I had read this and could have saved 2 days worth of research wondering why Eclipse was behaving differently. – Reddymails Jan 25 '19 at 20:12