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
473
votes
20 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,981
  • 6
  • 37
  • 39
457
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,873
  • 3
  • 17
  • 25
454
votes
6 answers

How are "mvn clean package" and "mvn clean install" different?

What exactly are the differences between mvn clean package and mvn clean install? When I run both of these commands, they both seem to do the same thing.
user2388827
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
425
votes
6 answers

What is the purpose of mvnw and mvnw.cmd files?

When I created a Spring Boot application I could see mvnw and mvnw.cmd files in the root of the project. What is the purpose of these two files?
shaunthomas999
  • 5,544
  • 2
  • 26
  • 30
423
votes
12 answers

Updating version numbers of modules in a multi-module Maven project

I have a multi-module maven project. We intend to version all these modules together. But as of now I am ending up hard-coding version in each of the module pom.xml as below xyz-application
sandeepkunkunuru
  • 6,150
  • 5
  • 33
  • 37
419
votes
12 answers

Maven skip tests

I am using Maven 2.2.1 and to build my project I used this command mvn clean install -Dmaven.test.skip=true However, the build failed saying it couldn't find one of the artifact. However, when I used: mvn clean install -DskipTests everything…
Prabhjot
  • 4,496
  • 2
  • 18
  • 22
413
votes
15 answers

How to fix error "Updating Maven Project". Unsupported IClasspathEntry kind=4?

I have imported maven project in STS, when I run update update project I receive: "Updating Maven Project". Unsupported IClasspathEntry kind=4 Is there a workaround for this?
user810430
  • 11,181
  • 15
  • 38
  • 43
395
votes
19 answers

Force Intellij IDEA to reread all maven dependencies

How to force intellij idea to reread/update all dependencies specified in the pom file ?
kubek2k
  • 5,613
  • 2
  • 22
  • 16
389
votes
10 answers

What is a Maven artifact?

What is an artifact and why does Maven need it?
Maxim Veksler
  • 29,272
  • 38
  • 131
  • 151
389
votes
9 answers

What are Maven goals and phases and what is their difference?

What is the difference/relation between Maven goals and phases? How they are related to each other?
Tarun Kumar
  • 5,150
  • 6
  • 26
  • 30
381
votes
22 answers

How do I load a file from resource folder?

My project has the following structure: /src/main/java/ /src/main/resources/ /src/test/java/ /src/test/resources/ I have a file in /src/test/resources/test.csv and I want to load the file from a unit test in /src/test/java/MyTest.java I have this…
codereviewanskquestions
  • 13,460
  • 29
  • 98
  • 167
372
votes
7 answers

Maven 3 warnings about build.plugins.plugin.version

Since I updated to Maven 3 I get the following warning messages at each build : How can I get rid of these warnings? [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for…
Istao
  • 7,425
  • 6
  • 32
  • 39
369
votes
4 answers

What is the maven-shade-plugin used for, and why would you want to relocate Java packages?

I found the maven-shade-plugin being used in someone's pom.xml. I've never used maven-shade-plugin before (and I'm a Maven n00b) so I tried to understand the reason for using this and what it does. I looked at the Maven docs, however I can't…
nonbeing
  • 6,907
  • 6
  • 36
  • 46
369
votes
7 answers

Maven command to determine which settings.xml file Maven is using

How do I use maven command line to determine which settings.xml file Maven is picking up?
harschware
  • 13,006
  • 17
  • 55
  • 87