Questions tagged [maven-2]

Apache Maven is a software project management and comprehension tool. This is a tag for Maven related questions that are specific to Maven versions 2.x.

About Maven:

Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.

For questions that are not version-specific, use , for Maven 3.x - specific questions, use

Please be aware of Maven 2 End Of Life

Maven Releases History, with documentation

5702 questions
2870
votes
33 answers

How can I create an executable/runnable JAR with dependencies using Maven?

I want to package my project in a single executable JAR for distribution. How can I make a Maven project package all dependency JARs into my output JAR?
soemirno
  • 29,244
  • 3
  • 19
  • 14
896
votes
12 answers

How do I tell Maven to use the latest version of a dependency?

In Maven, dependencies are usually set up like this: wonderful-inc dream-library 1.2.3 Now, if you are working with libraries that have frequent…
Anders Sandvig
  • 20,720
  • 16
  • 59
  • 73
739
votes
24 answers

Can I add jars to Maven 2 build classpath without installing them?

Maven 2 is driving me crazy during the experimentation / quick and dirty mock-up phase of development. I have a pom.xml file that defines the dependencies for the web-app framework I want to use, and I can quickly generate starter projects from that…
purple
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
552
votes
7 answers

Maven Modules + Building a Single Specific Module

I have a multi-module Maven project with a parent project P and three sub-modules A, B, and C. Both B and C are war projects and both depend on A. I can type mvn compile in P and have all of the sub-modules properly compiled. The problem comes…
Brian Ferris
  • 7,557
  • 5
  • 25
  • 27
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
441
votes
16 answers

Including dependencies in a jar with Maven

Is there a way to force maven(2.0.9) to include all the dependencies in a single jar file? I have a project the builds into a single jar file. I want the classes from dependencies to be copied into the jar as well. Update: I know that I cant just…
racer
  • 4,497
  • 3
  • 18
  • 13
369
votes
7 answers

Maven command to determine which settings.xml file Maven is using

How do I use maven command line to determine which settings.xml file Maven is picking up?
harschware
  • 13,006
  • 17
  • 55
  • 87
366
votes
5 answers

Maven: Command to update repository after adding dependency to POM

I've added a new dependency to my POM. Is there a simple command I can run to download this dependency to my repository?
DJ180
  • 18,724
  • 21
  • 66
  • 117
351
votes
4 answers

Maven artifact and groupId naming

I'm currently in the process of moving some project from Ant to Maven. Conformist as I am, I want to use well-established conventions for finding groupId and artifactId, but I can't find any detailed conventions (there are some, but they don't cover…
Noarth
  • 3,981
  • 6
  • 23
  • 16
351
votes
8 answers

Is there a simple way to remove unused dependencies from a maven pom.xml?

I have a large Maven project with many modules and many pom.xml files. The project has changed and I suspect the pom's contain some unnecessary dependencies. Is there is a command which removes any unused dependencies from a pom?
thickosticko
313
votes
5 answers

Making Maven run all tests, even when some fail

I have a project with several modules. When all tests pass, Maven test runs them all. When tests fail in the first module, maven will not continue to the next project. I have testFailureIgnore set to true in Surefire settings, but it doesn't…
ripper234
  • 222,824
  • 274
  • 634
  • 905
308
votes
21 answers

Find Oracle JDBC driver in Maven repository

I want to add the oracle jdbc driver to my project as dependency (runtime scope) - ojdbc14. In MVNrepository site the dependency to put in the POM is: com.oracle ojdbc14
rperez
  • 8,430
  • 11
  • 36
  • 44
299
votes
21 answers

SLF4J: Class path contains multiple SLF4J bindings

I'm getting the following error. It seems there are multiple logging frameworks bound to slf4j. Not sure how to resolve this. Any help is greatly appreciated. SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in…
user1493140
  • 5,976
  • 4
  • 29
  • 49
296
votes
2 answers

run main class of Maven project

I've created a simple console Java application that is built with Maven. Is there a way that the main class (which doesn't require any arguments) can be run from the command-line using a maven command like: mvn run-app com.example.MainClass
Dónal
  • 185,044
  • 174
  • 569
  • 824
1
2 3
99 100