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
186
votes
12 answers

stop IntelliJ IDEA to switch java language level every time the pom is reloaded (or change the default project language level)

Using IntelliJ 12, I have a java project and I use maven with a pom.xml. My project is using java8, but it seems the default project language level has been set to 6 while importing the project. I can change the language level to 8.0 (F4 -> Modules…
Quentin
  • 3,150
  • 4
  • 24
  • 34
185
votes
7 answers

"java.lang.OutOfMemoryError: PermGen space" in Maven build

I'm getting this error while building Maven project, I increased MAVEN_OPTS but all the same, I found some similar posts but they are refering to something else. How do I fix this? The system is out of resources. Consult the following stack trace…
Gandalf StormCrow
  • 25,788
  • 70
  • 174
  • 263
184
votes
4 answers

What is MOJO in Maven?

I'm reading about Maven right now and everywhere in a text I see this word (mojo). I approximately understand what it means, but I would not refuse from a good explanation. I tried to google, but found only non-maven explanations. POJO - ok, but…
dnim
  • 2,470
  • 4
  • 20
  • 19
183
votes
6 answers

How can I get maven-release-plugin to skip my tests?

How can I get the maven-release-plugin to run without triggering the tests? I have tried -Dmaven.test.skip=true and -DskipTests and -DpreparationGoals=clean ...yet none work. Yes, I know I shouldn't release if the tests don't pass, but I…
Steven
  • 2,189
  • 3
  • 15
  • 12
182
votes
2 answers

How can you display the Maven dependency tree for the *plugins* in your project?

A common Maven debugging technique is to use mvn dependency:tree to view the graph of project dependencies. However, this list shows the project dependencies, not the plugin dependency tree for each plugin. Is there some way to do this from a…
Alex Miller
  • 69,183
  • 25
  • 122
  • 167
182
votes
21 answers

MapStruct + Lombok together not compiling: unknown property in result type

Tech Stack being used : Java 8 MapStruct : 1.2.0.Final Lombok: 1.16.18 IDE: IntelliJ - Lombok Plugin already installed Initially, I faced issues when I removed getters and setters and added @Getter and @Setter annotation, mapstruct is not able to…
Vivek Gupta
  • 2,534
  • 3
  • 15
  • 28
180
votes
15 answers

Maven: best way of linking custom external JAR to my project?

It's my first couple of days learning Maven and I'm still struggling with the basics. I have an external .jar file (not available in the public repos) that I need to reference in my project and I'm trying to figure out what my best option is. It's…
Alexandr Kurilin
  • 7,685
  • 6
  • 48
  • 76
180
votes
15 answers

Deploying Maven project throws java.util.zip.ZipException: invalid LOC header (bad signature)

I am getting the below exception when I run my mvn install. I have even deleted the local repository and ran again getting same exception. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.1:shade (default) on project…
Karthick
  • 1,943
  • 3
  • 15
  • 16
179
votes
13 answers

Re-run Spring Boot Configuration Annotation Processor to update generated metadata

I've added: org.springframework.boot spring-boot-configuration-processor true to my pom.xml per intellij's request/warning. Now I'm seeing…
Eric Francis
  • 23,039
  • 31
  • 88
  • 122
178
votes
11 answers

Unable to compile simple Java 10 / Java 11 project with Maven

I have a trivial Maven project: src └── main └── java └──…
ZhekaKozlov
  • 36,558
  • 20
  • 126
  • 155
178
votes
2 answers

Sharing src/test classes between modules in a multi-module maven project

I have a multi-module Maven project. For the sake of this example, consider two modules: data consumer Module consumer has module data as a dependency. Module data declares a bunch of core classes. There are tests under src/test that use them. …
Greg Kopff
  • 15,945
  • 12
  • 55
  • 78
177
votes
11 answers

How to change maven logging level to display only warning and errors?

I want to prevent maven from displaying INFO messages, I want to see only WARNINGS and ERRORS (if any). How can I achieve this, preferably by changing the command line that calls maven?
sorin
  • 161,544
  • 178
  • 535
  • 806
177
votes
26 answers

Problems using Maven and SSL behind proxy

I just downloaded Maven and was trying to run the simple command found on the "Maven in Five Minutes" page (http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html). This is the command: mvn archetype:generate…
Andy
  • 4,475
  • 4
  • 19
  • 20
176
votes
7 answers

Maven - How to compile tests without running them ?

Is there a way in Maven to compile the tests without running them ? I want to use the IDE to run specific tests and not all of them.
user373201
  • 10,945
  • 34
  • 112
  • 168
174
votes
13 answers

Error: ENOENT: no such file or directory, scandir

I scaffold an app using jhipster which is microservice gateway using cassandra db and using maven to build which was building fine after scaffold.i ran gulp command to for the live reload of ui. i made a change slighlty in navbar and home page of…
Dhiresh Budhiraja
  • 2,575
  • 5
  • 17
  • 26