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
163
votes
34 answers

Intellij idea cannot resolve anything in maven

I just imported 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 work, I try import the…
Burst
  • 1,755
  • 2
  • 11
  • 7
159
votes
20 answers

Error "The goal you specified requires a project to execute but there is no POM in this directory" after executing maven command

I have a pom.xml in C:\Users\AArmijos\Desktop\Factura Electronica\MIyT\componentes-1.0.4\sources\pom.xml and I executed: mvn install:install-file -DgroupId=es.mityc.jumbo.adsi -DartifactId=xmlsec-1.4.2-ADSI -Dversion=1.0 -Dpackaging=jar…
Adrian
  • 7,745
  • 5
  • 28
  • 28
158
votes
15 answers

Maven: The packaging for this project did not assign a file to the build artifact

I'm using Maven 3.0.3 on Mac 10.6.6. I have a JAR project and when I run the command "mvn clean install:install", I'm getting the error, [ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.3.1:install (default-cli) on…
Dave
  • 8,667
  • 25
  • 72
  • 90
153
votes
6 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
  • 33,478
  • 73
  • 290
  • 513
143
votes
6 answers

How to keep Maven profiles which are activeByDefault active even if another profile gets activated?

I have a profile in my pom.xml which should be always active unless it is explicitely deactivated (-P !firstProfile). I solved this by using the activeByDefault flag: firstProfile
Peter
  • 1,471
  • 3
  • 11
  • 4
133
votes
6 answers

Maven command to list lifecycle phases along with bound goals?

I'm just learning Maven, and so this might be obvious, but I can't find an easy way to list the goals associated for each maven lifecycle phase for a given project. I saw that the Maven default life cycle phases and corresponding default goals are…
Upgradingdave
  • 12,916
  • 10
  • 62
  • 72
127
votes
2 answers

Run a single Maven plugin execution?

I thought I was an experienced Maven user, but I am having a mental block on how to do this! I've been able to use the Maven sql plugin to drop, create, and install a schema in a database via plugin executions I've defined and bound to the…
Dave
  • 21,524
  • 28
  • 141
  • 221
127
votes
7 answers

Maven: Lifecycle vs. Phase vs. Plugin vs. Goal

Relatively new developer here, even though I've been using it for a little while, I'm hoping to solidify my Maven fundamentals. Part of my problem is that I have no experience with Ant, which seems to be from where many explanations stem. I've been…
Jeff Levine
  • 2,083
  • 9
  • 30
  • 38
126
votes
4 answers

How to access maven.build.timestamp for resource filtering

I am using maven 3.0.4 and would like to make the build timestamp accessible to my application. For this, I'm putting a placeholder in a .properties file and let maven filter on build. While this is working fine for ${project.version},…
kostja
  • 60,521
  • 48
  • 179
  • 224
111
votes
8 answers

MAVEN_HOME, MVN_HOME or M2_HOME

What's the correct Maven environment variable name: MAVEN_HOME, MVN_HOME or M2_HOME? I've found some details about MAVEN_HOME and M2_HOME here. But I also have seen MVN_HOME around.
cassiomolin
  • 124,154
  • 35
  • 280
  • 359
110
votes
1 answer

How to override the `project.build.finalName` Maven property from the command line?

I have the following plain pom running by Maven 3.0.4.
glaz666
  • 8,707
  • 19
  • 56
  • 75
102
votes
11 answers

m2e error in MavenArchiver.getManifest()

I am seeing an error in my STS and am not sure how to debug it. Searching around I only see vague references to the error and no solutions. The error is: org.apache.maven.archiver.MavenArchiver.getManifest(org.apache.maven.project.MavenProject,…
scottmf
  • 1,506
  • 2
  • 14
  • 16
101
votes
5 answers

maven dependency without version

Recently I've been working on some improvements in a project developed some time ago, and here's what I found. A lot of dependencies in the pom files go without versions specified, and yet they are resolved. The project consists of 1 root module and…
yuranos
  • 8,799
  • 9
  • 56
  • 65
100
votes
16 answers

'dependencies.dependency.version' is missing error, but version is managed in parent

I have a maven project that contains several modules. In Eclipse (Juno, with m2e) it seems to compile fine. But when I do a maven install on one of the modules, the build fails immediately. Parent pom: com.sw.system4
fancyplants
  • 1,577
  • 3
  • 14
  • 25
98
votes
16 answers

Maven Out of Memory Build Failure

As of today, my maven compile fails. [INFO] [ERROR] Unexpected [INFO] java.lang.OutOfMemoryError: Java heap space [INFO] at java.util.Arrays.copyOfRange(Arrays.java:2694) [INFO] at java.lang.String.(String.java:203) [INFO] at…
Kevin Meredith
  • 41,036
  • 63
  • 209
  • 384