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.
maven-3
5,242
questions
716
votes
14
answers
504k
views
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.
645
votes
26
answers
1.1m
views
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 ...
519
votes
7
answers
377k
views
How can I 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!
...
382
votes
7
answers
505k
views
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 ...
304
votes
2
answers
345k
views
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? [closed]
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 ...
302
votes
16
answers
355k
views
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 ...
299
votes
7
answers
319k
views
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 ...
280
votes
5
answers
409k
views
How is "mvn clean install" different from "mvn install"?
What is the difference between mvn clean install and mvn install?
238
votes
41
answers
677k
views
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 - ...
216
votes
22
answers
249k
views
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 ...
212
votes
8
answers
82k
views
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 ...
193
votes
2
answers
77k
views
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....
182
votes
18
answers
885k
views
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 ...
181
votes
33
answers
1.2m
views
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] ...
177
votes
11
answers
400k
views
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.
<modules>
<module>first-module</module>
<module>my-module</...
174
votes
21
answers
376k
views
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....
166
votes
35
answers
288k
views
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 ...
163
votes
17
answers
241k
views
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....
159
votes
7
answers
205k
views
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 ...
144
votes
7
answers
60k
views
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:
<profiles>
<profile&...
136
votes
6
answers
46k
views
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 ...
134
votes
2
answers
85k
views
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 ...
130
votes
7
answers
60k
views
Maven: Lifecycle vs. Phase vs. Plugin vs. Goal [closed]
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 ...
128
votes
4
answers
106k
views
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 ...
116
votes
8
answers
293k
views
MAVEN_HOME, MVN_HOME or M2_HOME [duplicate]
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.
111
votes
20
answers
301k
views
'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 ...
111
votes
1
answer
146k
views
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.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/...
109
votes
5
answers
145k
views
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 ...
103
votes
17
answers
291k
views
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....
102
votes
11
answers
138k
views
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....
96
votes
17
answers
283k
views
Maven 3 and JUnit 4 compilation problem: package org.junit does not exist
I am trying to build a simple Java project with Maven. In my pom-file I declare JUnit 4.8.2 as the only dependency. Still Maven insists on using JUnit version 3.8.1. How do I fix it?
The problem ...
96
votes
4
answers
128k
views
Warning on using project.parent.version as the version of a module in Maven 3
In maven multi-module projects where I want each of the modules to always keep the same version as the parent, I've typically done something like the following in the module's pom.xml:
<parent&...
96
votes
1
answer
151k
views
How do I add a project as a dependency of another project?
There are two independent projects (myWarProject and MyEjbProject). So when I build the myWarProject I need to install the MyEjbProject in to the local repository, so then I can define in the ...
93
votes
1
answer
59k
views
Can not set the final jar name with maven-assembly-plugin
This is how I configured maven-assembly-plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<...
91
votes
5
answers
221k
views
maven error: package org.junit does not exist
I'm trying to create the javadoc with maven and it fails. It also fails when doing the verify.
mvn verify
I get the following error:
(...)
[INFO] ------------------------------------------------...
89
votes
16
answers
130k
views
Finding the root directory of a multi module Maven reactor project
Is there an easy way to find the root of a multi-module Maven project, like Gradle's rootDir?
Background:
I want to use the maven-dependency-plugin to copy artifacts from all sub-modules of my multi-...
89
votes
7
answers
188k
views
NoClassDefFoundError on Maven dependency
My first use of Maven and I'm stuck with dependencies.
I created a Maven project with Eclipse and added dependencies, and it was working without problems.
But when I try to run it via command line:
$ ...
89
votes
6
answers
74k
views
How do you deal with maven-3 timestamped snapshots efficiently?
Now that maven-3 did drop support for the <uniqueVersion>false</uniqueVersion> for snapshot artefacts it seems that you really need to use timestamped SNAPSHOTS. Especially m2eclipse, ...
84
votes
6
answers
162k
views
Maven spring boot run debug with arguments
Usually I'm running my Spring Boot application with command:
mvn spring-boot:run -Drun.arguments=--server.port=9090 \
-Dpath.to.config.dir=/var/data/my/config/dir
I want to set custom port to ...
83
votes
4
answers
62k
views
Correct way to declare multiple scope for Maven dependency?
I have a dependency that I want to use in test scope (so that it is in the classpath when I am running unit tests), and in runtime scope (so that I can contain that in WAR/EAR/other packaging for ...
82
votes
6
answers
127k
views
How do I prevent Maven from downloading artifacts every time?
I’m using Maven 3.1.1. In one of my projects, I reference another one of my projects …
<dependencies>
<dependency>
<groupId>org.mainco.subco</groupId>
<...
79
votes
3
answers
92k
views
Send maven output to file
On Windows 7, I am trying to send the output of a maven-3 command to a text file.
I call the command from the root of the project I am trying to analyze.
The command is:
mvn dependency:tree -...
78
votes
7
answers
54k
views
What is the Maven way for automatic project versions when doing continuous delivery?
I have a web application where we deploy to production whenever a feature is ready, sometimes that can be a couple of times a day, sometimes it can be a couple of weeks between releases.
Currently, ...
76
votes
10
answers
55k
views
Intellij Idea Maven 'cannot reconnect' error
Maybe you can help me
I got a strange apache maven's problem, when opening my project at Intellij Idea 13.
When projects was open I have no libraries at External Libraries section. And at all pom.xml ...
74
votes
5
answers
56k
views
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 ...
72
votes
10
answers
21k
views
IntelliJ new project - maven archetype list empty
When creating IntelliJ → New Project → Maven, the archetype list is blank and does not populate no matter how long the amount of time elapsed. The "Loading archetype list..." continues but does not ...
72
votes
7
answers
179k
views
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 ...
68
votes
7
answers
128k
views
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
<project>
<groupId>org.koshik.javabrains</...
67
votes
2
answers
53k
views
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 ...
66
votes
4
answers
34k
views
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, ...