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
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
205
votes
10 answers

How do I get my Maven Integration tests to run

I have a maven2 multi-module project and in each of my child modules I have JUnit tests that are named Test.java and Integration.java for unit tests and integration tests respectively. When I execute: mvn test all of the JUnit tests *Test.java…
Peter Delaney
  • 5,278
  • 9
  • 33
  • 40
203
votes
5 answers

Sharing Test code in Maven

How can you depend on test code from another module in Maven? Example, I have 2 modules: Base Main I would like a test case in Main to extend a base test class in Base. Is this possible? Update: Found an acceptable answer, which involves…
flicken
  • 15,443
  • 4
  • 29
  • 29
199
votes
13 answers

Get Maven artifact version at runtime

I have noticed that in a Maven artifact's JAR, the project.version attribute is included in two files: META-INF/maven/${groupId}/${artifactId}/pom.properties META-INF/maven/${groupId}/${artifactId}/pom.xml Is there a recommended way to read this…
Armand
  • 23,463
  • 20
  • 90
  • 119
195
votes
4 answers

Disable a Maven plugin defined in a parent POM

I am using a parent POM that defines a plugin that I do not want to be run in a child POM. How can I disable the plugin in the child pom completely? Constraint: I cannot change the parent POM itself.
tobiasbayer
  • 10,269
  • 4
  • 46
  • 64
189
votes
13 answers

Force re-download of release dependency using Maven

I'm working on a project with dependency X. X, in turn, depends on Y. I used to explicitly include Y in my project's pom. However, it was not used and to make things cleaner, I instead added it to X's pom as a dependency. X is marked as a release…
volni
  • 5,196
  • 8
  • 38
  • 44
189
votes
8 answers

Importing Maven project into Eclipse

I want to import existing Maven project into Eclipse. I found 2 ways to do it: Through running from command line mvn eclipse:eclipse To install Maven Eclipse plugin from Eclipse. What is the difference between the both and which one is preferable?…
Thunderhashy
  • 5,291
  • 13
  • 43
  • 47
187
votes
9 answers

Differences between Ant and Maven

Could someone tell me the differences between Ant and Maven? I have never used either. I understand that they are used to automate the building of Java projects, but I do not know where to start from.
rtacconi
187
votes
18 answers

Get source jar files attached to Eclipse for Maven-managed dependencies

I am using Maven (and the Maven Eclipse Integration) to manage the dependencies for my Java projects in Eclipse. The automatic download feature for JAR files from the Maven repositories is a real time saver. Unfortunately, it does not include API…
Thilo
  • 257,207
  • 101
  • 511
  • 656
186
votes
15 answers

Specify JDK for Maven to use

I am trying to build a Hudson plugin I've modified and it requires jdk1.6. This is fine, but I don't see how I can tell maven where the different jdk is. I've found few mentions on the internet but they don't seem to apply to me. Some suggest adding…
DanInDC
  • 5,019
  • 8
  • 31
  • 25
181
votes
15 answers

Spring 3.0 - Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/security]

Any ideas what could be the cause of this? Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/security] org.springframework.web.context.ContextLoader initWebApplicationContext: Context…
Taylor Leese
  • 51,004
  • 28
  • 112
  • 141
180
votes
15 answers

Maven: best way of linking custom external JAR to my project?

It's my first couple of days learning Maven and I'm still struggling with the basics. I have an external .jar file (not available in the public repos) that I need to reference in my project and I'm trying to figure out what my best option is. It's…
Alexandr Kurilin
  • 7,685
  • 6
  • 48
  • 76
177
votes
11 answers

How to change maven logging level to display only warning and errors?

I want to prevent maven from displaying INFO messages, I want to see only WARNINGS and ERRORS (if any). How can I achieve this, preferably by changing the command line that calls maven?
sorin
  • 161,544
  • 178
  • 535
  • 806
175
votes
5 answers

Maven: how to override the dependency added by a library

Here's my generic problem: My project P depends on A which depends on B which depends on C which depends on version 1.0.1 of D. There's a problem with version 1.0.1 of D and I want to force the use of another module. I don't know how to declare this…
wishihadabettername
  • 14,231
  • 21
  • 68
  • 85
161
votes
2 answers

mvn clean install vs. deploy vs. release

I am just learning maven, and we have recently needed to go more and more. I would like to know the difference between mvn clean install mvn release mvn deploy Please be as descriptive as possible.
Mahdi Yusuf
  • 19,931
  • 26
  • 72
  • 101