Questions tagged [maven-3]

Apache Maven is a tool for project management and build automation. This tag is for questions relating to Maven version 3.x. For non version-specific questions, please use the [maven] tag.

Apache Maven is a tool for project management and build automation. Maven relies on a pom.xml file that describes the project instead of defining a set of tasks, like Ant does.

A basic pom.xml looks like:

<project>
  <!-- model version is always 4.0.0 for Maven 2 and Maven 3 POMs -->
  <modelVersion>4.0.0</modelVersion>

  <!-- A project is identified by its groupId, artifactId and version -->
  <groupId>com.mycompany.app</groupId>
  <artifactId>my-app</artifactId>
  <version>1.0</version>

  <!-- Dependencies -->
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.8.1</version>
      <!--
           The scope allows you to limit the usage of this dependency.
           In this case, this library will only be used for tests purposes.
      -->
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>

Many plugins exist, and offer more functionalities to the tool.


For non version-specific questions, please use , for the older maven versions 2.x or the legacy 1.x use or , 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.

4947 questions
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
425
votes
6 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
  • 13,244
  • 5
  • 32
  • 59
338
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,015
  • 6
  • 30
  • 39
304
votes
2 answers

How to install Maven 3 on Ubuntu 18.04/17.04/16.10/16.04 LTS/15.10/15.04/14.10/14.04 LTS/13.10/13.04 by using apt-get?

Try: sudo apt-get install maven If it works for you ignore the rest of this post. Intro I started setting up my Ubuntu 12.10 on April 2013 and the normal sudo apt-get install maven was not working for maven 3 back then. The manual installation in…
AmirHd
  • 10,027
  • 11
  • 37
  • 59
266
votes
15 answers

Make Maven to copy dependencies into target/lib

How do I get my project's runtime dependencies copied into the target/lib folder? As it is right now, after mvn clean install the target folder contains only my project's jar, but none of the runtime dependencies.
Michael
  • 2,789
  • 3
  • 17
  • 5
230
votes
5 answers

How is "mvn clean install" different from "mvn install"?

What is the difference between mvn clean install and mvn install?
Leonid
  • 19,596
  • 22
  • 62
  • 88
220
votes
36 answers

Import Maven dependencies in IntelliJ IDEA

I have a small question about IntelliJ IDEA 11. I just imported a project from subversion - its a maven project. But I have a problem in maven library dependencies so that I can't include all maven dependencies automatically - IDEA shows dependency…
Zaur Guliyev
  • 3,994
  • 7
  • 26
  • 42
206
votes
4 answers

Specifying java version in maven - differences between properties and compiler plugin

I'm not very experienced with maven and while experimenting with multi-module project I started wondering how can I specify java version for all my child modules in parent maven pom. Until today I was using just:
Plebejusz
  • 2,482
  • 2
  • 15
  • 25
177
votes
6 answers

Maven check for updated dependencies in repository

Is there a Maven plugin that allows you to check if there are newer versions of dependencies available in the repository? Say, you are using dependency X with version 1.2. Now a new version of X is released with version 1.3. I'd like to know, based…
froethen
  • 1,783
  • 2
  • 11
  • 5
148
votes
25 answers

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile)

I am using Maven 3.0.5 and Spring Tool Source 3.2 with Maven plugin installed. When I try to do 'Run As---> Maven install', I am getting the following error: [INFO] Scanning for projects... [INFO] …
Rushi Shah
  • 1,761
  • 2
  • 12
  • 9
147
votes
14 answers

Maven Could not resolve dependencies, artifacts could not be resolved

This is supposed to be a working project from my friend. He demonstrated the project right in front of me, and then I copied the project, imported it as an existing maven project (I'm using m2eclipse plugin). And then, this error occurs. This error…
Albert Gan
  • 16,262
  • 44
  • 125
  • 177
139
votes
31 answers

Intellij idea cannot resolve anything in maven

I'm new to Intellij Idea, i just import a project with pom.xml, but the ide didn't resolve anything in maven dependencies. Anything defined in pom.xml dependencies when import in code raise an error cannot resolve symbol xxxxx But mvn install will…
Burst
  • 1,515
  • 2
  • 10
  • 7
136
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
  • 14,301
  • 10
  • 49
  • 67
128
votes
5 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
  • 29,080
  • 65
  • 239
  • 450
1
2 3
99 100