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
71
votes
7 answers

Cannot load properties file from resources directory

I imported a project from a Git repository and added Maven nature to it in Eclipse. In the resources folder, I added a configuration file called myconf.properties. Now, whenever I try to open this file from my Java code, I get FileNotFoundException.…
artaxerxe
  • 6,281
  • 21
  • 68
  • 106
71
votes
4 answers

Unable to locate Source XRef to link to

I have a big Maven project that uses the PMD plugin for code quality checks. since I started using the PMD plugin i get the following warning message: [WARNING] Unable to locate Source XRef to link to - DISABLED I googled and found that i need to…
ufk
  • 30,912
  • 70
  • 235
  • 386
63
votes
2 answers

Generate Javadoc HTML using maven?

Right now I am using the maven-javadoc-plugin to attach the Javadoc to .jar artifacts when I am doing a release. However, how can I generate the Javadoc in an html format so we can scp it to a remote server for reference? Thanks!
Sam Levin
  • 3,326
  • 7
  • 30
  • 44
63
votes
7 answers

Plugins in Maven and POM.xml

I just started using Maven and I read that plugins are additional components that can be used. A typical structure of pom.xml file is org.koshik.javabrains JarName (A fldernamed JarName was…
Rajeshwar
  • 11,179
  • 26
  • 86
  • 158
62
votes
3 answers

How to check pom.xml for updated dependencies

I am fairly new to Maven and pom.xml. Is there a way I can find out which of my dependencies that are outdated, so that I can update version numbers in my pom.xml. In other languages, for instance, Ruby has the command gem list outdated that gives…
Jesper Rønn-Jensen
  • 106,591
  • 44
  • 118
  • 155
62
votes
2 answers

What are all of the Maven Command Line Options?

I'm looking for the list of options for Maven 2.2 but cannot find it. If someone knows the location please post it. Thank you. I found the following but I don't know enough of Maven to know which are and are not in 2.2. Version Maven 3.3.3 CLI…
edjm
  • 4,830
  • 7
  • 36
  • 65
62
votes
1 answer

Exclude maven dependency for tests

I have a dependency that is needed for a compilation and runtime but I want to exclude it when running tests. Is this possible? Maybe, by setting up a profile? But how do I deactivate it only for test lifecycle phase?
jFrenetic
  • 5,384
  • 5
  • 42
  • 67
60
votes
9 answers

Buildr, Gradle or wait for Maven 3?

I am really tired of struggling with Maven 2 all the time. Build tools should not be in the way. Recently I have been looking at Buildr and Gradle. Maven 3 seems to fix some of the struggles. So, what should I go for now? Buildr? Gradle? Or wait a…
Sten Roger Sandvik
  • 2,526
  • 2
  • 19
  • 16
59
votes
4 answers

Changing the order of maven plugins execution

I am new to maven, I would like to change the order of the maven plugins execution. In my pom.xml, I have maven-assembly-plugin and maven-ant-plugin. maven-assembly-plugin for creating a zip file. maven-ant-plugin for copying the zip file from…
user1062115
  • 591
  • 1
  • 4
  • 4
58
votes
4 answers

Maven Compilation Error: (use -source 7 or higher to enable diamond operator)

I'm using maven in IntelliJ, JDK1.8, maven 3.2.5. Got compilation error: use -source 7 or higher to enable diamond opera. details are as follows: [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- …
HappyCoding
  • 5,029
  • 7
  • 31
  • 51
57
votes
3 answers

how to exclude all artifacts from a group in maven?

I am using maven 3 with the Enforcer plugin configured to force version convergence. I am using Spring 3.1.2 and Spring Security 3.1.3. The problem is that Spring 3.1.3 POM declares dependencies on Spring 3.0.7 because that is the minimum version…
ams
  • 60,316
  • 68
  • 200
  • 288
57
votes
6 answers

Maven: Overview for the values of Maven properties

I would like to find out the values of all Maven properties as they apply to some Maven project. mvn help:system lists OS environment variables and JVM system properties, but no Maven properties. mvn help:evaluate only works in an interactive mode,…
Abdull
  • 26,371
  • 26
  • 130
  • 172
54
votes
2 answers

Builds are tagged unstable even when they are successful

I am running Jenkins version 1.411 and use Maven for building. Even though the application builds successfully, Jenkins treats it as an unstable build. I have disabled all tests to isolate the problem. [INFO]…
Croydon Dias
  • 1,906
  • 5
  • 20
  • 27
54
votes
6 answers

Is Maven ready for JDK9?

Today I tried the latest jdk9 Build 113 and tried to compile my project with the latest Maven 3.3.9 These are the commands (found partially via twitter) export MVN_OPTS="-Dmaven.compiler.fork…
Karussell
  • 17,085
  • 16
  • 97
  • 197
53
votes
3 answers

Maven assembly plugin warning "The assembly descriptor contains a filesystem-root relative reference"

Starting from some assembly plugin version maven builds issue the following warning: [WARNING] The assembly descriptor contains a filesystem-root relative reference,which is not cross platform compatible / Is there any recommended ready-to-use…
Roman Nikitchenko
  • 12,800
  • 7
  • 74
  • 110