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:

79345 questions
1320
votes
31 answers

How to add local jar files to a Maven project?

How do I add local jar files (not yet part of the Maven repository) directly in my project's library sources?
Praneel PIDIKITI
  • 15,781
  • 13
  • 36
  • 59
953
votes
33 answers

How to solve "Plugin execution not covered by lifecycle configuration" for Spring Data Maven Builds

I am trying to work with Spring Data and Neo4j. I started by trying to follow this guide linked to by the main site. In particular I based my pom.xml off of the "Hello, World!" example file. Here is a snip from my pom.xml for the plugin that is…
Andrew White
  • 50,300
  • 17
  • 108
  • 132
931
votes
14 answers

What exactly is a Maven Snapshot and why do we need it?

I am a bit confused about the meaning of a Maven Snapshot and why we build one?
meisam
  • 9,858
  • 5
  • 15
  • 15
872
votes
13 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 version.…
hguser
  • 31,173
  • 49
  • 145
  • 269
827
votes
12 answers

How do I tell Maven to use the latest version of a dependency?

In Maven, dependencies are usually set up like this: wonderful-inc dream-library 1.2.3 Now, if you are working with libraries that have frequent…
Anders Sandvig
  • 19,763
  • 16
  • 56
  • 71
798
votes
25 answers

How to force maven update?

I imported my already working project on another computer and it started to download dependencies. Apparently my internet connection crashed and now I get the following: >Build errors for comics;…
M4ks
  • 10,316
  • 6
  • 23
  • 47
759
votes
11 answers

Dealing with "Xerces hell" in Java/Maven?

In my office, the mere mention of the word Xerces is enough to incite murderous rage from developers. A cursory glance at the other Xerces questions on SO seem to indicate that almost all Maven users are "touched" by this problem at some point. …
Justin Garrick
  • 14,057
  • 6
  • 39
  • 65
694
votes
33 answers

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

I'm compiling a project in Eclipse using m2eclipse. I set the JDK path in Eclipse like this: Windows-->preferences-->installed jres--> jdk1.7.xx path But this is showing an error [ERROR] COMPILATION ERROR : [INFO]…
Sai prateek
  • 10,642
  • 8
  • 39
  • 60
675
votes
21 answers

When maven says "resolution will not be reattempted until the update interval of MyRepo has elapsed", where is that interval specified?

With maven, I occasionally hit an artifact that comes from some 3rd-party repo that I haven't built or included in my repository yet. I'll get an error message from the maven client saying that an artifact can't be found: Failure to find…
cprice404
  • 6,759
  • 3
  • 13
  • 3
653
votes
56 answers

IntelliJ inspection gives "Cannot resolve symbol" but still compiles code

Platform: IntelliJ Community Edition 10.0.3 SDK: jdk1.6.0_21 OS: Windows 7 So I have a strange situation with IntelliJ that has me completely stumped. I setup a Maven project and add log4j as a dependency in the pom.xml file. The IDEA inspections…
Kevin Sitze
  • 6,939
  • 3
  • 14
  • 19
591
votes
25 answers

Maven Install on Mac OS X

I'm trying to install maven through the terminal by following these instructions. So far I got this export M2_HOME=/user/apple/apache-maven-3.0.3 export M2=$M2_HOME/bin export PATH=$M2:$PATH export JAVA_HOME=/usr/java/jdk1.6.0_22 This is probably a…
Edgardo Roldan
  • 6,012
  • 3
  • 14
  • 9
575
votes
13 answers

Run a single test method with maven

I know you can run all the tests in a certain class using: mvn test -Dtest=classname But I want to run an individual method and -Dtest=classname.methodname doesn't seem to work.
BillMan
  • 8,105
  • 9
  • 29
  • 51
457
votes
30 answers

Maven does not find JUnit tests to run

I have a maven program, it compiles fine. When I run mvn test it does not run any tests (under TESTs header says There are no tests to run.). I've recreated this problem with a super simple setup which I will include below as well as the output…
Zugwalt
  • 19,935
  • 20
  • 77
  • 99
450
votes
19 answers

Get source JARs from Maven repository

Does anyone have any idea if you can find source JARs on Maven repositories?
Ioan Alexandru Cucu
  • 11,149
  • 6
  • 35
  • 39
438
votes
14 answers

The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

I have a project created by Maven integration in Eclipse. All work fine, but in the work space in all JSP files have this: The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path To the first string where place: <%@…
disable1992
  • 4,673
  • 3
  • 15
  • 23
1
2 3
99 100