Questions tagged [pom.xml]

A Project Object Model or POM is the fundamental unit of work in Maven.

POM

The POM is an XML file that contains information about the project and configuration details used by to build the project. It contains default values for most projects. Examples for this is the build directory, which is target; the source directory, which is src/main/java; the test source directory, which is src/main/test; and so on.

The POM was renamed from project.xml in Maven v1 to pom.xml in Maven v2. Instead of having a maven.xml file that contains the goals that can be executed, the goals or plugins are now configured in the pom.xml. When executing a task or goal, Maven looks for the POM in the current directory. It reads the POM, gets the needed configuration information, then executes the goal.

Some of the configurations that can be specified in the POM are the project dependencies, the plugins or goals that can be executed, the build profiles, and so on. Other information such as the project version, description, developers, mailing lists, and such can also be specified.

References

Frequently Asked Questions

5202 questions
1051
votes
15 answers

Differences between dependencyManagement and dependencies in Maven

What is the difference between dependencyManagement and dependencies? I have seen the docs at Apache Maven web site. It seems that a dependency defined under the dependencyManagement can be used in its child modules without specifying the…
hguser
  • 35,079
  • 54
  • 159
  • 293
445
votes
12 answers

IntelliJ - Convert a Java project/module into a Maven project/module

I have a project on Bitbucket. Only the sources are committed. To retrieve the project onto a new machine, I used Version Control > Checkout from Version Control from within IntelliJ. It then asks whether I would like to create a new project from…
Neil Traft
  • 18,367
  • 15
  • 63
  • 70
323
votes
5 answers

What is pluginManagement in Maven's pom.xml?

This is a snippet of my pom file. .... org.apache.maven.plugins maven-dependency-plugin 2.4
263
votes
5 answers

How do you specify the Java compiler version in a pom.xml file?

I wrote some Maven code in Netbeans that has approximately more than 2000 lines. When I compile it on Netbeans, everything is fine, but if I want to run it on command line, I will get these errors: generics are not supported in -source 1.3 (use…
MTT
  • 5,113
  • 7
  • 35
  • 61
243
votes
4 answers

What is under in pom.xml for?

Looking at documentation http://maven.apache.org/surefire/maven-surefire-plugin/examples/testng.html, we can see tag under What is that and how can we use it for running test?
Alpha
  • 13,320
  • 27
  • 96
  • 163
214
votes
10 answers

What does mvn install in maven exactly do

I just started using Maven and I was told to do mvn install in a specific directory. What does mvn install do, exactly? I think it looks for pom.xml in the current folder and starts following the instructions specified in that file. Is that…
Rajeshwar
  • 11,179
  • 26
  • 86
  • 158
211
votes
6 answers

How to refer environment variable in POM.xml?

I am using maven as build tool. I have set an environment variable called env. How can I get access to this environment variable's value in the pom.xml file?
user1016403
  • 12,151
  • 35
  • 108
  • 137
186
votes
12 answers

stop IntelliJ IDEA to switch java language level every time the pom is reloaded (or change the default project language level)

Using IntelliJ 12, I have a java project and I use maven with a pom.xml. My project is using java8, but it seems the default project language level has been set to 6 while importing the project. I can change the language level to 8.0 (F4 -> Modules…
Quentin
  • 3,150
  • 4
  • 24
  • 34
186
votes
15 answers

Specify JDK for Maven to use

I am trying to build a Hudson plugin I've modified and it requires jdk1.6. This is fine, but I don't see how I can tell maven where the different jdk is. I've found few mentions on the internet but they don't seem to apply to me. Some suggest adding…
DanInDC
  • 5,019
  • 8
  • 31
  • 25
174
votes
9 answers

What is the difference in Maven between dependency and plugin tags in pom.xml?

Created project with Spring, Hibernate & Maven. My question is what is the logic behind plugin versus dependency ?
Soumyaansh
  • 8,626
  • 7
  • 45
  • 45
160
votes
11 answers

Is there anyway to exclude artifacts inherited from a parent POM?

Artifacts from dependencies can be excluded by declaring an element inside a But in this case it's needed to exclude an artifact inherited from a parent project. An excerpt of the POM under discussion follows:
Miguel
  • 1,999
  • 2
  • 14
  • 14
158
votes
15 answers

Maven: The packaging for this project did not assign a file to the build artifact

I'm using Maven 3.0.3 on Mac 10.6.6. I have a JAR project and when I run the command "mvn clean install:install", I'm getting the error, [ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.3.1:install (default-cli) on…
Dave
  • 8,667
  • 25
  • 72
  • 90
154
votes
3 answers

What is the difference between "pom" type dependency with scope "import" and without "import"?

Starting from Maven 2.0.9 there is possibility to include pom import in the section. As I understand it, it will be "replaced" with dependencies included in this pom as if they were originally…
grafthez
  • 3,921
  • 4
  • 28
  • 42
143
votes
21 answers

Why am I getting Unknown error in line 1 of pom.xml?

Getting unknown error at Line 1 in pom.xml in Eclipse IDE. It was working fine till yesterday, but all of a sudden after updating my project from master and after fixing merge conflicts getting "Unknown error" in pom.xml. Except me, none of my…
Shravani
  • 1,622
  • 2
  • 11
  • 16
135
votes
2 answers

Install parent POM without building Child modules

I have a parent POM in a Maven project, with this structure: parent | --------------- | | child1 child2 I want to install the POM of the "parent" in the local REPO to allow child1…
Mr.Eddart
  • 10,050
  • 13
  • 49
  • 77
1
2 3
99 100