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.

5199 questions
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
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
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
305
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,308
  • 11
  • 41
  • 60
292
votes
16 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
  • 3,049
  • 3
  • 19
  • 5
284
votes
6 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
  • 3,332
  • 2
  • 19
  • 26
271
votes
5 answers

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

What is the difference between mvn clean install and mvn install?
Leonid
  • 22,360
  • 25
  • 67
  • 91
235
votes
39 answers

Import Maven dependencies in IntelliJ IDEA

I just imported a project from subversion to IntelliJ IDEA 11 - it's 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 errors only when I open…
Zaur Guliyev
  • 4,254
  • 7
  • 28
  • 44
207
votes
8 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
  • 2,083
  • 2
  • 13
  • 5
189
votes
22 answers

How to disable maven blocking external HTTP repositories?

Maven blocks external HTTP repositories by default since version 3.8.1 (see https://maven.apache.org/docs/3.8.1/release-notes.html) Is there a way to disable that or to exempt a repository from this rule?
Sebu
  • 4,671
  • 5
  • 16
  • 29
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
175
votes
33 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
  • 2,031
  • 2
  • 14
  • 10
169
votes
18 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…
Bertie
  • 17,277
  • 45
  • 129
  • 182
168
votes
12 answers

How do I force Maven to use my local repository rather than going out to remote repos to retrieve artifacts?

I’m using Maven 3.3.3 with Java 8 on Mac Yosemite. I have a multi-module project. first-module my-module When I build my one of my child…
Dave
  • 15,639
  • 133
  • 442
  • 830
1
2 3
99 100