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
1593
votes
35 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
  • 18,677
  • 13
  • 41
  • 60
1072
votes
15 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
  • 11,346
  • 5
  • 17
  • 15
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
1005
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
  • 52,720
  • 19
  • 113
  • 137
913
votes
26 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
  • 11,744
  • 7
  • 27
  • 48
896
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
  • 20,720
  • 16
  • 59
  • 73
812
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,767
  • 7
  • 41
  • 66
801
votes
25 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
  • 8,019
  • 3
  • 15
  • 3
761
votes
63 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
  • 8,029
  • 3
  • 16
  • 19
724
votes
38 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
  • 11,842
  • 9
  • 51
  • 66
692
votes
14 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
  • 9,434
  • 9
  • 32
  • 52
641
votes
26 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 Where do you go…
Edgardo Roldan
  • 6,522
  • 3
  • 16
  • 9
535
votes
34 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…
Aaron Silverman
  • 22,070
  • 21
  • 83
  • 103
522
votes
23 answers

Maven package/install without test (skip tests)

I am trying to package my project. But, it automatically runs the tests previous do performing the packaging. The tests insert some content in the database. This is not what I want, I need to avoid running tests while package the application.…
vks
  • 6,649
  • 7
  • 36
  • 55
505
votes
7 answers

How to configure encoding in Maven?

When I run maven install on my multi module maven project I always get the following output: [WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! So, I googled around a bit, but all I can find…
Ethan Leroy
  • 15,804
  • 9
  • 41
  • 63
1
2 3
99 100