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
153
votes
6 answers

Why is Maven downloading the maven-metadata.xml every time?

Below is the error I usually get when my internet connection is flanky when trying to build a web application with maven. My question is that, why does maven always have to download every time when the same app has been built earlier. What could…
quarks
  • 33,478
  • 73
  • 290
  • 513
152
votes
2 answers

Pros and cons of using sbt vs maven in Scala project

Which build tool is the best for Scala? What are the pros and cons of each of them? How to I determine which one of them to use in a project?
Konstantin Solomatov
  • 10,252
  • 8
  • 58
  • 88
151
votes
6 answers

How do I add a Maven dependency in Eclipse?

I don't know how to use Maven at all. I've been developing for a couple years with Eclipse and haven't yet needed to know about it. However, now I'm looking at some docs that suggest I do the following: "To include it within your project, just…
Riley Lark
  • 20,660
  • 15
  • 80
  • 128
151
votes
8 answers

Mvn install or Mvn package

I am new to Maven, I have a Java based web project with maven configured in my MyEclipse. Now if I modified any java files then do I need to do Run as -> Mvn install or Mvn package?
user2192023
  • 1,601
  • 2
  • 11
  • 12
149
votes
35 answers

Maven2: Missing artifact but jars are in place

From now to then, my Maven 2 started to mess around. I am using SPring STS 2.6.1 and have a single project based on Spring 3, Hibernate, DWR, Cometd and all that stuff. Today I just updated from Git und all of a sudden, I got that scary mvn…
Jannick
  • 2,094
  • 3
  • 17
  • 21
149
votes
32 answers

Maven package works but Intellij's build fails

I have a JDK 1.7 project with a maven dependency to a local jar in my maven repo. I'm unable to build the project using Intellij, with the errors that a symbol cannot be found (the symbol is a class importing packages from the local jar) But I can…
Yarin Miran
  • 3,241
  • 6
  • 30
  • 27
149
votes
1 answer

Is there a way to pass JVM args via command line to Maven?

Possible Duplicate: Maven Jetty plugin - how to control VM arguments? In particular, I want to do something like this: mvn -DjvmArgs="-Xmx2000m -Xms1000m -XX:PermSize=512m -XX:MaxPermSize=512m" jetty:run -Pmyprofile Oh, and I would like to do…
Charlotte Tan
  • 2,452
  • 2
  • 20
  • 24
148
votes
18 answers

Maven: Non-resolvable parent POM

I have my maven project setup as 1 shell projects and 4 children modules. When I try to build the shell. I get: [INFO] Scanning for projects... [ERROR] The build could not read 1 project -> [Help 1] [ERROR] [ERROR] The project module1:1.0_A0…
Will
  • 8,246
  • 16
  • 60
  • 92
148
votes
3 answers

Why does Maven warn me about encoding?

My goal is to create an archetype from a project. When I run a goal that does not involve the maven-archetype-plugin, I can't see any warning: [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven-archetype-base --- [INFO]…
Marco Ferrari
  • 4,914
  • 5
  • 33
  • 53
147
votes
2 answers

How do I find out which settings.xml file maven is using

I recently changed my password and have to change my maven settings.xml file to reflect that. However, no matter what I do in the settings.xml file, the changed password just won't get picked up. Out of desperation, I ran maven with the -s switch…
RAY
  • 6,810
  • 6
  • 40
  • 67
146
votes
1 answer

repository tag under distributionManagement vs repositories?

I see repository tag under parent element i.e distributionManagement and repositories. What's the difference ? ... ... ...
emilly
  • 10,060
  • 33
  • 97
  • 172
146
votes
9 answers

Maven Jacoco Configuration - Exclude classes/packages from report not working

I have a maven multi-module project and I'm using jacoco-maven for code coverage reports. Some classes should not be reported, as they're Spring configuration and I'm not interested in them. I have declared the maven-jacoco plugin as…
resilva87
  • 3,325
  • 5
  • 32
  • 43
146
votes
8 answers

Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize

When building a Java 8 project with Maven: mvn clean package I get this message: Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0 How to remove this message?
Boris
  • 22,667
  • 16
  • 50
  • 71
146
votes
14 answers

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test

I have scoured the internet for almost five days now looking for a fix to this issue, but I cannot seem to find and fix it on my own, mainly because I am so new to both Maven and PlayN so I'm not entirely sure at what I'm looking at exactly. But,…
DoctorDep
  • 1,611
  • 2
  • 11
  • 10
145
votes
8 answers

Can Maven be made less verbose?

Maven spews out far too many lines of output to my taste (I like the Unix way: no news is good news). I want to get rid of all [INFO] lines, but I couldn't find any mention of an argument or config settings that controls the verbosity of Maven. Is…
Asaf Bartov
  • 2,711
  • 3
  • 20
  • 18