how to configure maven to add junit 4.10 instead of 3.8 dependency in new project
Solution 1
The junit version is described in archetype that is used to create maven project.
You need to either find archetype that will fit your needs, or create your own.
Then once you have it you need to select to use this archetype when creating the project in Eclipse.
Solution 2
It's pretty common to have a company/product wide version of one of the following: -
- A common parent pom with a dependency management section controlling all your versions
- A common pom which is included as a dependency and imports all the testing dependencies, e.g., my-company-test. That can either include your common test code as well or be of type
pom
and just act as a dependency vacuum. - An archetype (as frant.hartm says) which defines all of your common dependency versions up front.
I would personally go with both the dependency based pom and an archetype which imports it.
You can always override versions if you need too.
Solution 3
You have to state the version
that you want in the dependency, for example I use JUnit 4.11 in Eclipse Juno:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
So you need to set your version
to 4.10 or whatever version there is that you desire.
Abhishek Nayak
(Last updated: 15/08/2020) I am a programmer with 8 years of experience. I have hands on experience implementing enterprise application using: Java/Java EE Restful Spring (Boot / MVC / DATA JPA / Data Rest / Eureka / Configuration server) JPA (Hibernate) JQuery Bootstrap (2.3/3.2) Microservices Cloud environment (Native/Pivotal) Learning currently: AWS Angular Thank you for checking out the profile. you can reach out to me @ [email protected]
Updated on June 04, 2022Comments
-
Abhishek Nayak almost 2 years
When i am creating a new maven project in eclipse kepler, eclipse automatically adds junit 3.8 dependency in pom.xml like
<dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8</version> <scope>test</scope> </dependency>
I want to be available newer version like: 4.10,
Where can i configure to use newer version instead of old?
-
Line over 5 years@frant.hartm Why even now the default JUnit version in Eclipse Maven archetype is 3, not 4 whcih seems to be current?