Questions tagged [maven]

Apache Maven is a build automation and project management tool used primarily for Java projects. This tag is for questions that don't relate to a specific Maven version. Use the gradle tag instead for questions relating to Gradle.

Apache Maven is a build automation tool used primarily for Java projects. Based on the concept of a Project Object Model (POM), Maven can manage a project's build, reporting, and documentation from a central piece of information.

Maven's objectives

Maven’s primary goal is to allow a developer to comprehend the complete state of a development effort in the shortest period of time. Maven adheres to the principle of "convention over configuration" that helps building Maven projects with very little configuration. Systems, libraries, and frameworks should assume reasonable defaults, and systems should "just work" without requiring unnecessary configuration. In order to attain this goal, there are several areas of concern that Maven attempts to deal with:

  • Making the build process easy
  • Providing a uniform build system
  • Providing quality project information
  • Providing guidelines for best practices development
  • Allowing transparent migration to new features

The configuration of a Maven project is done by creating a file called pom.xml located at the root of the project. This file is referred to as the POM file. Each POM file inherits from a global Super POM that defined common properties for all Maven projects.

If you see questions with this tag that specifically refer to the Maven versions 2.x, 3.x (or the legacy 1.x), please re-tag them with , and , respectively.

If you see questions related to a specific Maven plugin, please also check whether the related plugin tag is present (i.e. , ).

Questions related to Maven plugin development should also have the , while questions related to Maven profiles should also have the tag, and questions related to Maven archetypes should also have the tag.

More information

Free Maven Books

Frequently Asked Questions:

People often ask about the following topics:

General:

Maven Repository:

87627 questions
257
votes
11 answers

Maven project version inheritance - do I have to specify the parent version?

I have two projects: Parent project: A, Sub project: B A/pom.xml: com.dummy.bla parent 0.1-SNAPSHOT pom And in B/pom.xml, I have:
Shengjie
  • 12,336
  • 29
  • 98
  • 139
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
235
votes
12 answers

Java compiler level does not match the version of the installed Java project facet

I have created a New Dynamic Project under Eclipse Helios Version, where my JRE Version is set to 1.6. I have added Maven capabilities to the Web Application by clicking on Configure → Convert to Maven Project. After adding this, a build error…
user974802
  • 3,397
  • 10
  • 26
  • 29
235
votes
39 answers

Import Maven dependencies in IntelliJ IDEA

I just imported a project from subversion to IntelliJ IDEA 11 - it's a maven project. But I have a problem in maven library dependencies so that I can't include all maven dependencies automatically - IDEA shows dependency errors only when I open…
Zaur Guliyev
  • 4,254
  • 7
  • 28
  • 44
232
votes
7 answers

disable maven download progress indication

In our company in the CI machines maven local repository is purged before every build. As result my build logs always have a bunch of noise like this Downloading:…
gsf
  • 6,612
  • 7
  • 35
  • 64
227
votes
20 answers

Maven surefire could not find ForkedBooter class

Recently coming to a new project, I'm trying to compile our source code. Everything worked fine yesterday, but today is another story. Every time I'm running mvn clean install on a module, once reaching the tests, it crashes into an error: [INFO]…
Sylordis
  • 2,528
  • 3
  • 17
  • 20
223
votes
4 answers

maven command line how to point to a specific settings.xml for a single command?

Is it possible to point to a specific settings file in order to override the default settings.xml being used by maven for a single command? Example: mvn clean install -Dparam # -> pass specific settings file path as param to override default…
guilhebl
  • 8,330
  • 10
  • 47
  • 66
217
votes
28 answers

Maven dependencies are failing with a 501 error

Recently Maven build jobs running in Jenkins are failing with the below exception saying that they couldn't pull dependencies from Maven Central and should use HTTPS. I'm not sure how to change the requests from HTTP to HTTPS. Could someone guide me…
Arunan Sugunakumar
  • 3,311
  • 3
  • 12
  • 20
217
votes
4 answers

Maven project.build.directory

In Maven, what does the project.build.directory refer to? I am a bit confused, does it reference the source code directory or the target directory in the Maven project?
faisal abdulai
  • 3,739
  • 8
  • 44
  • 66
215
votes
3 answers

Spring Boot - parent pom when you already have a parent pom

Is there a specific recommended approach to the inclusion of the spring-boot parent pom into projects that already have a required parent POM? What do you recommend for projects that need to extend from an organizational parent (this is extremely…
Scott C.
  • 3,672
  • 4
  • 18
  • 20
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
212
votes
14 answers

Best practices for copying files with Maven

I have config files and various documents that I want to copy from the dev environment to the dev-server directory using Maven2. Strangely, Maven does not seem strong at this task. Some of the options: Simple use a copy task in Maven
Joshua Fox
  • 18,704
  • 23
  • 87
  • 147
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
210
votes
25 answers

Getting "Skipping JaCoCo execution due to missing execution data file" upon executing JaCoCo

I'm using Maven 3.0.3, JUnit 4.8.1, and Jacoco 0.6.3.201306030806, and I am trying to create test coverage reports. I have a project with unit tests only, but I can't get reports to run, I'm repeatedly getting the error: Skipping JaCoCo execution…
Dave
  • 15,639
  • 133
  • 442
  • 830
209
votes
11 answers

How do I tell Spring Boot which main class to use for the executable jar?

Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.0.1.RELEASE:repackage failed: Unable to find a single main class from the following candidates My project has more than one class with a main method. How do I tell the…
Thilo
  • 257,207
  • 101
  • 511
  • 656